the main help i need at this point is
Overall goal: submit a buy order. retrieve its fill price. submit a sell limit order based off its fill price. so I figured, since the streamconn listen is giving me the devil, I would set the ‘client_order_ID’, and do a loop with list_order and that ID until ‘filled_avg_price’ is no longer == to none for that particular order… store the price that is in the ‘filled_avg_price’ and submit my sell order based off that.
so here, i am trying to get a list of my orders. I have 4 at the moment, and was playing with the [:1] to pull the first one by itself. then i want to reach inside that order and pull ‘filled_avg_price’ out of it. i thought converting it to a pandas dataframe would be easiest… but honestly i dont know much coding at all and dont know anything about pandas, just trying to find examples in other codes and apply things until it works.
if extract_open < extract_close:
#buy_order = api.submit_order(“ENPH”, 1, “buy”, “market”, “day”)
get_order = api.list_orders()
order = get_order[:2]
print(order)
order = pd.DataFrame(order)
print(order)
here is my printed stuff
Yesterday’s Close 36.1300
Today’s Open 34.0500
[Order({ ‘asset_class’: ‘us_equity’,
‘asset_id’: ‘b0b6dd9d-8b9b-48a9-ba46-b9d54906e415’,
‘canceled_at’: None,
‘client_order_id’: ‘5a5a6b3c-5d28-4b16-9fee-a8c2982a3f09’,
‘created_at’: ‘2020-03-30T16:11:24.27903Z’,
‘expired_at’: None,
‘extended_hours’: False,
‘failed_at’: None,
‘filled_at’: None,
‘filled_avg_price’: None,
‘filled_qty’: ‘0’,
‘id’: ‘95a88880-bfdd-42c7-99e1-d6c0742854c4’,
‘legs’: None,
‘limit_price’: ‘200’,
‘order_class’: ‘’,
‘order_type’: ‘limit’,
‘qty’: ‘1’,
‘replaced_at’: None,
‘replaced_by’: None,
‘replaces’: None,
‘side’: ‘buy’,
‘status’: ‘new’,
‘stop_price’: None,
‘submitted_at’: ‘2020-03-30T16:11:24.243821Z’,
‘symbol’: ‘AAPL’,
‘time_in_force’: ‘day’,
‘type’: ‘limit’,
‘updated_at’: ‘2020-03-30T16:11:24.370317Z’})]
0
0 Order({ ‘asset_class’: ‘us_equity’,\n 'as…
so i think this tells me column is labeled 0 and row is labeled 0 in the dataframe. now how do i reach inside this and extract info??