df change

This commit is contained in:
DJ Nieto
2021-04-16 12:04:23 -06:00
parent 0dd93d21e5
commit 72f3390d66

View File

@@ -91,16 +91,9 @@ def get_order_book(instrument):
try:
request = instruments.InstrumentsOrderBook(instrument=instrument)
response = client.request(request)
for i in range(len(response["orderBook"]["buckets"])):
order_instrument = response["orderBook"]["instrument"]
price = response["orderBook"]["buckets"][i]["price"]
short_count_percent = response["orderBook"]["buckets"][i]["shortCountPercent"]
long_count_percent = response["orderBook"]["buckets"][i]["longCountPercent"]
print(f"Instrument: {order_instrument}")
print(f"Price: {price}")
print(f"Short count percent: {short_count_percent}")
print(f"Long count percent: {long_count_percent}")
print("-" * 30)
df = pd.DataFrame.from_dict(response["orderBook"]["buckets"])
pd.set_option("display.max_rows", None)
print(df)
except V20Error as e:
print(e)
@@ -369,10 +362,6 @@ def calendar(instrument, other_args: List[str]):
}
request = labs.Calendar(params=parameters)
response = client.request(request)
df = pd.DataFrame.from_dict(response)
df = df[["title", "timestamp", "impact" , "forecast", "unit", "market",
"region", "previous", "currency" ]]
print(df)
for i in range(len(response)):
if "title" in response[i]:
title = response[i]["title"]