6 votes

Fortnightly Programming Q&A Thread

General Programming Q&A thread! Ask any questions about programming, answer the questions of other users, or post suggestions for future threads.

Don't forget to format your code using the triple backticks or tildes:

Here is my schema:

```sql
CREATE TABLE article_to_warehouse (
  article_id   INTEGER
, warehouse_id INTEGER
)
;
```

How do I add a `UNIQUE` constraint?

3 comments

  1. [3]
    Gyrfalcon
    Link
    I've been working on a little quantitative finance project, and I am not sure how I want to store my price data. It would be a bit of a pain to redownload it every time, especially if I want to do...

    I've been working on a little quantitative finance project, and I am not sure how I want to store my price data. It would be a bit of a pain to redownload it every time, especially if I want to do anything with fine timescales, since I can only download 5000 bars at a time. In a past foray into this space I made use of SQLite for this task, but thinking about it now I'm not sure that's the right choice. It seems to me like a relational database is best when you actually would want to select only parts of your data. I guess I may want to do that, but more likely I'll want to read in all the data and the split out different parts as I go, so I was kind of thinking of just creating directories to sort out instruments and granularities, and then storing the bid and ask prices in CSV files. Is there merit for a database in something like this?

    2 votes
    1. [2]
      DataWraith
      Link Parent
      Have you considered a Time series database such as InfluxDB or Prometheus? I must confess that I have little experience with them, and none with quantitative finance (so this might not work at...

      Have you considered a Time series database such as InfluxDB or Prometheus?

      I must confess that I have little experience with them, and none with quantitative finance (so this might not work at all), but price data seems like a temporal data stream to me that a TSDB could be well-suited for.

      3 votes
      1. Gyrfalcon
        Link Parent
        InfluxDB especially looks like it could be useful, and I should be able to pull the Python bindings into Julia. I'm not sure that I will be updating the database during live trading much though,...

        InfluxDB especially looks like it could be useful, and I should be able to pull the Python bindings into Julia. I'm not sure that I will be updating the database during live trading much though, so I'm not sure that a lot of the features will get used. Either way, an interesting option to check out. Thanks!

        2 votes