alpaca-trade-api icon indicating copy to clipboard operation
alpaca-trade-api copied to clipboard

Upgrades bars api endpoint to use v2

Open mwlang opened this issue 1 year ago • 1 comments

This is my first time using this gem and as I started using it, discovered bars endpoint was still on v1, which no longer exists.

There seems to be a lot of forward changes on the Alpaca endpoint since the bars endpoint was originally written, so this is a bit of a breaking change as well by introducing keyword arguments for all params.

Notes:

  • Alpaca::Trade::Api::Bar now has :trades and :weighted_average_price properties.
  • timestamps now return as strings and not ordinal on time, so Time.at changed to Time.parse on the Bar class.
  • timeframe method argument now a keyword argument (breaking change). Now optional and defaults to '1D'
  • symbols method argument now keyword argument (breaking change). Can accept a string for single symbol lookup.
  • asof optional parameter needed if desiring to look up FB or META correctly (see API docs). Defers to API when omitted.
  • feed optional parameter to modify source of data feed for the symbols. Defaults to 'sip'
  • start_date optional parameter to set the starting date for historical feed. Defers to API when omitted.
  • end_date optional parameter to set the ending date for historical feed. Defers to API when omitted.
  • Rspec can now be run with focus: true when focusing on specific specs.

There are some pre-existing failing specs unrelated to changes to bars which I did not address.

mwlang avatar Dec 02 '23 20:12 mwlang

I'm using this fork for my own project (and will add/fix anything beyond the work you've done), just wanted to say thanks and respect.

web2boomer avatar Jan 27 '24 21:01 web2boomer