alpaca-trade-api
alpaca-trade-api copied to clipboard
Upgrades bars api endpoint to use v2
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 toTime.parse
on theBar
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 upFB
orMETA
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.
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.