fix from fdbk

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2021-09-18 19:35:04 +02:00
parent 50b1ddfb29
commit 8a9f3dd184
2 changed files with 7 additions and 4 deletions

View File

@ -7,7 +7,7 @@
# How to run using docker
* `docker build . -t microwavedcola/mango-service-v3`
* `docker run -p 8080:3000 -e GROUP=mainnet.1 -e CLUSTER_URL=https://api.mainnet-beta.solana.com -v ~/.config:/root/.config microwavedcola/mango-service-v3`
* `docker run -p 3000:3000 -e GROUP=mainnet.1 -e CLUSTER_URL=https://api.mainnet-beta.solana.com -v ~/.config:/root/.config microwavedcola/mango-service-v3`
# How to test
* via postman, see `service-v3.postman_collection.json`

View File

@ -1,6 +1,7 @@
import inspect
import json
from typing import List, Union
import os
from typing import List
import httpx
from httpx import TimeoutException
@ -15,7 +16,6 @@ from mango_service_v3_py.dtos import (
Candle,
Order,
PlaceOrder,
BadRequestError,
)
@ -29,7 +29,10 @@ def timeout_error_msg_customizer(response):
class Exchange:
def __init__(self):
self.BASE_URL = "http://localhost:3000/api"
if "BASE_URL" in os.environ:
self.BASE_URL = f"{os.environ['BASE_URL']}/api"
else:
self.BASE_URL = "http://localhost:3000/api"
def get_open_positions(self) -> List[Position]:
response = httpx.get(f"{self.BASE_URL}/positions")