update logs in python code

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2021-09-25 21:59:00 +02:00
parent 2947100f4d
commit 1019ba000e
3 changed files with 19 additions and 2 deletions

View File

@ -10,7 +10,7 @@ All environment variables are optional.
# How to run while developing
* `yarn install`
* `yarn nodemon ./src/server.ts`
* `yarn ts-node ./src/server.ts` or if you have `nodemon` installed then, `nodemon ./src/server.ts`
# How to run using docker
* `docker pull microwavedcola/mango-service-v3`

View File

@ -0,0 +1,16 @@
from mango_service_v3_py.api import MangoServiceV3Client
from mango_service_v3_py.dtos import PlaceOrder
if __name__ == "__main__":
mango_service_v3_client = MangoServiceV3Client()
print("orders before cancelling")
for order in mango_service_v3_client.get_orders():
print(order.json(indent=4, sort_keys=True))
print("")
mango_service_v3_client.cancel_all_orders()
print("orders after cancelling")
for order in mango_service_v3_client.get_orders():
print(order.json(indent=4, sort_keys=True))

View File

@ -17,6 +17,7 @@ if __name__ == "__main__":
mango_service_v3_client = MangoServiceV3Client()
market = mango_service_v3_client.get_market_by_market_name("BTC-PERP")[0]
print(f"latest btc-perp price is {market.last}")
mango_service_v3_client.cancel_all_orders()
@ -30,7 +31,7 @@ if __name__ == "__main__":
fibs_sum = sum(fibs)
for i, fib in enumerate(fibs):
price = market.last * (100 - fibs[-1] + fib) / 100
price = market.last * ((100 - fibs[-1] + fib) / 100)
price = mango_service_v3_client.to_nearest(price, market.price_increment)
size = (total_usd_balance / market.price) * (fibs[len(fibs) - 1 - i] / fibs_sum)