alpacahq / alpacahq/Alpaca-API

Submitted order does not appear on "trade_updates" event stream

Offen
#74 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
bug
Vorherrschende Sprache
Keine Sprachdaten
Sterne
173
Forks
17
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

(paper trading; v1)

In my experimentation an order submitted to the system reliably does not appear in the "trade_updates" stream of events until it is cancelled.

I listen to trade updates like this:
```py
import alpaca_trade_api as tradeapi
conn = tradeapi.StreamConn()

@conn.on(r'trade_updates')
async def on_account_updates(conn, channel, account):
print('trade', account)

conn.run(['trade_updates'])
```

Then I submit an order which is accepted
```
01:02:56 HTTP status: 200 OK
01:02:56 HTTP response: {"id":"e861a45a-ec58-4c54-99c6-e0001c936db8","client_order_id":"7567a582-234d-43e1-ad59-6ea1d2e6acf0","created_at":"2019-06-22T01:02:57.66207875Z","updated_at":"2019-06-22T01:02:57.680978319Z","submitted_at":"2019-06-22T01:02:57.65003418Z","filled_at":null,"expired_at":null,"canceled_at":null,"failed_at":null,"asset_id":"b28f4066-5c6d-479b-a2af-85dc1a8f16fb","symbol":"SPY","asset_class":"us_equity","qty":"1","filled_qty":"0","filled_avg_price":null,"order_type":"market","type":"market","side":"buy","time_in_force":"gtc","limit_price":null,"stop_price":null,"status":"new"}
```

I don't receive any events.

It's only when I cancel the order that I suddenly get informed about the cancellation *as well as* the creation:
```
trade Entity({ 'event': 'new',
'order': { 'asset_class': 'us_equity',
'asset_id': 'b28f4066-5c6d-479b-a2af-85dc1a8f16fb',
'canceled_at': None,
'client_order_id': '7567a582-234d-43e1-ad59-6ea1d2e6acf0',
'created_at': '2019-06-22T01:02:57.662079Z',
'expired_at': None,
'failed_at': None,
'filled_at': None,
'filled_avg_price': None,
'filled_qty': '0',
'id': 'e861a45a-ec58-4c54-99c6-e0001c936db8',
'limit_price': None,
'order_type': 'market',
'qty': '1',
'side': 'buy',
'status': 'new',
'stop_price': None,
'submitted_at': '2019-06-22T01:02:57.650034Z',
'symbol': 'SPY',
'time_in_force': 'gtc',
'type': 'market',
'updated_at': '2019-06-22T01:04:41.81251274Z'}})
trade Entity({ 'event': 'canceled',
'order': { 'asset_class': 'us_equity',
'asset_id': 'b28f4066-5c6d-479b-a2af-85dc1a8f16fb',
'canceled_at': '2019-06-22T01:04:41.809220438Z',
'client_order_id': '7567a582-234d-43e1-ad59-6ea1d2e6acf0',
'created_at': '2019-06-22T01:02:57.662079Z',
'expired_at': None,
'failed_at': None,
'filled_at': None,
'filled_avg_price': None,
'filled_qty': '0',
'id': 'e861a45a-ec58-4c54-99c6-e0001c936db8',
'limit_price': None,
'order_type': 'market',
'qty': '1',
'side': 'buy',
'status': 'canceled',
'stop_price': None,
'submitted_at': '2019-06-22T01:02:57.650034Z',
'symbol': 'SPY',
'time_in_force': 'gtc',
'type': 'market',
'updated_at': '2019-06-22T01:04:41.826689194Z'},
'timestamp': '2019-06-22T01:04:41.809220438Z'})
```

Why?

Beitragsleitfaden

Für dieses Repository ist kein Beitragsleitfaden indexiert

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.