Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No trade updates for crypto orders/positions #205

Open
Grimmble opened this issue Jun 20, 2022 · 1 comment
Open

No trade updates for crypto orders/positions #205

Grimmble opened this issue Jun 20, 2022 · 1 comment

Comments

@Grimmble
Copy link

Hi,

Ver: github.com/alpacahq/alpaca-trade-api-go/v2 v2.5.0

Seems that trade updates using the client.StreamTradeUpdates() functionality differ quite a bit from stocks to crypto.
For stocks I would be notified of any new, rejected, fill etc. type of events, doesn't seem to be the case for crypto where I've only been able to get canceled events.

Is there a different implementation for crypto streams? Or are the events different for crypto? (the docs doesn't give a clear indication about this)

NOTE: The code below works fine for stocks

// Start the trade client
client := alpaca.NewClient(alpaca.ClientOpts{
  ApiKey:     "***",
  ApiSecret:  "***",
  BaseURL:    "https://paper-api.alpaca.markets",
  RetryLimit: 100,
  RetryDelay: 5 * time.Second,
})

handler := func(tu alpaca.TradeUpdate) {
  fmt.Printf("NEW EVENT: %+v\n", tu)
}

err := client.StreamTradeUpdates(context.Background(), handler)
@Grimmble
Copy link
Author

Small update:

This seem specific to stop_limit type crypto orders. E.g. for SOLUSD:
Tried placing a market order and a new + fill event was immidately picked up by the client.StreamTradeUpdates() handler.
Then I tried placing a stop_limit order and no new event is picked up by the client.StreamTradeUpdates() handler (even though it show up in the Alpaca UI as "new")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant