td-ameritrade-python-api
td-ameritrade-python-api copied to clipboard
I am sure its me not thinking properly....But... using the Streaming data How to tell if the last trade was a Buy or Sell
Hi all...please forgive me with this question - I am pretty sure its me missing something obvious....
I am consuming the streaming data I get the Bid_Price, Ask_price,Last_Price, Last_Size data (amongst others)
To determine if that last order placed was a Buy or Sell I am taking the value of Last_Price and if its closer to the Ask_Price than the Bid_Price I am thinking the last trade was a buy. If the last_price is closer to the Bid_Price I am thinking the last trade was a sell.
Am I making a bad assumption? is there a better way to consume the streaming data and determine Buy/Sell ??
Thanks
Similar question. How can I tell how much of the volume is buy vs sell?
For options the entire chain is this. I see nothing in here that will get it for me. But it is done in TOS all the time. For now comparing call volume vs put but its not as good.
{'SPY': {'52WkHigh': 479.98,
'52WkLow': 371.88,
'askId': 'P',
'askPrice': 448.89,
'askSize': 100,
'assetMainType': 'EQUITY',
'assetSubType': 'ETF',
'assetType': 'ETF',
'bidId': 'K',
'bidPrice': 448.87,
'bidSize': 300,
'bidTick': ' ',
'closePrice': 446.6,
'cusip': '7',
'delayed': False,
'description': 'SPDR S&P 500',
'digits': 2,
'divAmount': 5.7182,
'divDate': '2021-12-17 00:00:00.000',
'divYield': 1.28,
'exchange': 'p',
'exchangeName': 'PACIFIC',
'highPrice': 452.78,
'lastId': 'D',
'lastPrice': 448.9,
'lastSize': 200,
'lowPrice': 443.83,
'marginable': True,
'mark': 448.89,
'markChangeInDouble': 2.29,
'markPercentChangeInDouble': 0.5128,
'nAV': 0.0,
'netChange': 2.3,
'netPercentChangeInDouble': 0.515,
'openPrice': 446.35,
'peRatio': 0.0,
'quoteTimeInLong': 1644008393904,
'realtimeEntitled': True,
'regularMarketLastPrice': 448.9,
'regularMarketLastSize': 2,
'regularMarketNetChange': 2.3,
'regularMarketPercentChangeInDouble': 0.515,
'regularMarketTradeTimeInLong': 1644008393889,
'securityStatus': 'Normal',
'shortable': True,
'symbol': 'SPY',
'totalVolume': 102892377,
'tradeTimeInLong': 1644008393889,
'volatility': 0.0077}}

thanks