alpacahq / Alpaca-API

The Alpaca API is a developer interface for trading operations and market data reception through the Alpaca platform.
https://alpaca.markets/
142 stars 13 forks source link

no account updates on submitted orders? #75

Open d-e-s-o opened 5 years ago

d-e-s-o commented 5 years ago

(paper trading; v1)

Is it intentional that no account updates are sent when an order is submitted/filled?

According to the documentation:

This stream provides clients with updates pertaining to their brokerage accounts at Alpaca, including balance information.

Yet, I don't get an updated when I submit an order and it is filled subsequently. Shouldn't the account balance change when doing that?

When I explicitly retrieve /v1/account information I see a difference in cash: 55279.74 USD beforehand, 54987.27 USD now

I have the following code for streaming updates:

import alpaca_trade_api as tradeapi

conn = tradeapi.StreamConn()

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

# blocks forever
conn.run(['account_updates'])
ttt733 commented 5 years ago

Hello, currently, we're not sending account updates with order updates. This is something that we would like to address, but it's not a feature we've had a chance to implement yet.

still-dreaming-1 commented 4 years ago

This would be the most common reason an account would "update". Otherwise if we are tracking how much tradable cash or buying power is in the account, we either need to calculate that manually after every trade comes through, or call out to the API to do a GET to download the account, which kind of defeats the point of subscribing to account updates. Don't most algorithms need to know how much is in the account to help them decide how many shares to buy of a particular stock?

I guess this is just a theoretical concern for me at the moment, as I am now realizing the strategy I am currently exploring works better without streaming anyways.

dans-acc commented 3 years ago

This would be the most common reason an account would "update". Otherwise if we are tracking how much tradable cash or buying power is in the account, we either need to calculate that manually after every trade comes through, or call out to the API to do a GET to download the account, which kind of defeats the point of subscribing to account updates. Don't most algorithms need to know how much is in the account to help them decide how many shares to buy of a particular stock?

I guess this is just a theoretical concern for me at the moment, as I am now realizing the strategy I am currently exploring works better without streaming anyways.

I completely agree with this. I think that publishing events relating to our account would drastically improve and ease the development of algos.

d-e-s-o commented 3 years ago

Meanwhile, in typical underhand fashion in a commit talking about something completely different, the section about account updates was removed from the docs. So expect that within half a year it will be removed entirely. No pull request, no review, no rationale provided, no discussion, no announcement, no deprecation notice, nothing. Alpaca. And not even that they manage to do properly for a change and left half the references to account updates in place: account_updates

Un-be-lie-va-ble.

jasonbohne123 commented 3 years ago

Meanwhile, in typical underhand fashion in a commit talking about something completely different, the section about account updates was removed from the docs. So expect that within half a year it will be removed entirely. No pull request, no review, no rationale provided, no discussion, no announcement, no deprecation notice, nothing. Alpaca. And not even that they manage to do properly for a change and left half the references to account updates in place: account_updates

Un-be-lie-va-ble.

Hello,

The section was removed as there are not any actual messages to be streamed from that subscription channel