alpacahq / marketstore

DataFrame Server for Financial Timeseries Data
Apache License 2.0
1.86k stars 226 forks source link

[alpaca] possibly outdated docs for streaming data #428

Open kierangilliam opened 3 years ago

kierangilliam commented 3 years ago

Hi, I've followed the basic setup for Marketstore with the Alpaca and GDAX feeder. GDAX data populates as expected but despite getting message notifications from Alpaca, no data is saved to the data folder.

Steps to reproduce:

docker create --volume "/root/data:/data" --name mktsdb -p 5993:5993 alpacamarkets/marketstore:latest
docker cp mkts.yml mktsdb:/etc/mkts.yml
docker start mktsdb

mkts.yml

root_directory: data
listen_port: 5993
log_level: info
queryable: true
stop_grace_period: 0
wal_rotate_interval: 5
enable_add: true
enable_remove: false
enable_last_known: false
timezone: "America/New_York"
triggers:
  - module: ondiskagg.so
    on: "*/1Min/OHLCV"
    config:
      filter: nasdaq
      destinations: [ '5Min', '15Min', '1H', '1D' ]
bgworkers:
  - module: gdaxfeeder.so
    name: Crypto
    config:
      query_start: '2018-01-01 00:00'
      symbols:
        - BTC-USD
      base_timeframe: '1D'
  - module: alpaca.so
    config:
      api_key: KEY
      api_secret: SECRET
      ws_server: wss://data.alpaca.markets/stream
      ws_worker_count: 10
      minute_bar_symbols:
        - '*'
      quote_symbols:
        - VOO
        - SPY
      trade_symbols:
        - AAPL
        - GME

Only items in ./data

WALFile.1612155387000035356.walfile 
gdax_BTC-USD
category_name

Despite getting seemingly sucessful responses from the alpaca server

...
{"level":"info","timestamp":"2021-02-01T04:56:27.610Z","msg":"[alpaca] subscribing to Alpaca data websocket: wss://data.alpaca.markets/stream"}
{"level":"info","timestamp":"2021-02-01T04:56:27.610Z","msg":"[alpaca] enabling ... {streams:[AM.* Q.VOO Q.SPY T.AAPL T.GME]}"}
{"level":"info","timestamp":"2021-02-01T04:56:27.610Z","msg":"[alpaca] using 10 workers"}
{"level":"info","timestamp":"2021-02-01T04:56:27.989Z","msg":"[alpaca] authenticated successfully"}
{"level":"info","timestamp":"2021-02-01T04:58:27.613Z","msg":"[alpaca] {subscription:[AM.* Q.VOO Q.SPY T.AAPL T.GME],channel_depth:0,handled_messages:0}"}

Did I miss a step to ensure that the data from Alpaca persists?

mtucker502 commented 3 years ago

Was this resolved?

jaggas commented 2 years ago

It appears the API was not updated for the V2 streaming interface.

It seems configured for the old style of WS subscription using AM.*, etc. https://alpaca.markets/docs/api-documentation/api-v2/market-data/alpaca-data-api-v1/streaming/ https://github.com/alpacahq/marketstore/blob/master/contrib/alpaca/api/connection.go

The interface needs to be updated to V2: https://alpaca.markets/docs/api-documentation/api-v2/market-data/alpaca-data-api-v2/real-time/

Is there anyone working this currently? If not, I can do it. It seems like it would make sense to make use of the officially supported golang Alpaca API.