Module: TDAmeritrade::Operations::Support::BuildWatchlistItems

Included in:
CreateWatchlist, ReplaceWatchlist, UpdateWatchlist
Defined in:
lib/tdameritrade/operations/support/build_watchlist_items.rb

Instance Method Summary collapse

Instance Method Details

#build_watchlist_items(symbol_list) ⇒ Object

This gem only supports EQUITY type, even though there is a lot more you can do with the API



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/tdameritrade/operations/support/build_watchlist_items.rb', line 5

def build_watchlist_items(symbol_list)
  symbol_list.map do |symbol|
    {
      "quantity": 0,
      "averagePrice": 0,
      "commission": 0,
      "purchasedDate": (Date.today).strftime('%Y-%m-%d'),
      "instrument": {
        "symbol": symbol,
        "assetType": "EQUITY"
      }
    }
  end
end