Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed Jul 2, 2019
1 parent 2948841 commit f644b2d
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 30 deletions.
7 changes: 4 additions & 3 deletions aat/callback.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ def onChange(self, data: MarketData):
def onError(self, data: MarketData):
'''onError'''

def onStart(self):
'''onStart'''
pass

def onExit(self):
'''onExit'''
pass
Expand Down Expand Up @@ -56,9 +60,6 @@ def __init__(self):
def onTrade(self, data: MarketData) -> None:
pass

def onReceived(self, data: MarketData) -> None:
pass

def onOpen(self, data: MarketData) -> None:
pass

Expand Down
26 changes: 0 additions & 26 deletions aat/define.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,29 +24,3 @@
# (ExchangeType.DERIBIT, TradingType.SIMULATION): 'wss://www.deribit.com/ws/api/v1/',

}.get((name, typ), None))

EXCHANGE_ORDER_ENDPOINT = lru_cache(None)(lambda name, typ: { # noqa: E731
(ExchangeType.COINBASE, TradingType.SANDBOX): 'https://api-public.sandbox.pro.coinbase.com',
(ExchangeType.COINBASE, TradingType.LIVE): 'https://api.pro.coinbase.com',
(ExchangeType.COINBASE, TradingType.SIMULATION): 'https://api.pro.coinbase.com',

(ExchangeType.GEMINI, TradingType.SANDBOX): 'https://api.sandbox.gemini.com/v1/marketdata/btcusd?heartbeat=true',
(ExchangeType.GEMINI, TradingType.LIVE): 'https://api.gemini.com/v1/marketdata/btcusd?heartbeat=true',
(ExchangeType.GEMINI, TradingType.SIMULATION): 'https://api.gemini.com/v1/marketdata/btcusd?heartbeat=true',

(ExchangeType.KRAKEN, TradingType.SANDBOX): '',
(ExchangeType.KRAKEN, TradingType.LIVE): '',

(ExchangeType.POLONIEX, TradingType.SANDBOX): '',
(ExchangeType.POLONIEX, TradingType.LIVE): '',

# (ExchangeType.DERIBIT, TradingType.SANDBOX): 'https://test.deribit.com',
# (ExchangeType.DERIBIT, TradingType.LIVE): 'https://www.deribit.com',
# (ExchangeType.DERIBIT, TradingType.SIMULATION): 'https://www.deribit.com',
}.get((name, typ), None))

ACCOUNTS = lambda name, typ: { # noqa: E731
# (ExchangeType.DERIBIT, TradingType.SANDBOX): 'https://test.deribit.com',
# (ExchangeType.DERIBIT, TradingType.LIVE): 'https://www.deribit.com',
# (ExchangeType.DERIBIT, TradingType.SIMULATION): 'https://www.deribit.com',
}.get((name, typ), None)
1 change: 1 addition & 0 deletions aat/enums.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ class CurrencyType(BaseEnum):
ETC = 'ETC'
ETH = 'ETH'
GNT = 'GNT'
LINK = 'LINK'
LOOM = 'LOOM'
LTC = 'LTC'
MANA = 'MANA'
Expand Down
11 changes: 10 additions & 1 deletion aat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import pytz
from datetime import datetime
from functools import lru_cache
from .enums import ExchangeType, ExchangeType_from_string, ExchangeTypes, CurrencyType, OrderType, Side, PairType
from .enums import ExchangeType, ExchangeType_from_string, ExchangeTypes, CurrencyType, OrderType, Side, PairType, TradeResult
from .exceptions import AATException
from .logging import log

Expand Down Expand Up @@ -38,6 +38,7 @@ def ex_type_to_ex(ex: ExchangeType):

@lru_cache(None)
def get_keys_from_environment(prefix: str) -> tuple:
prefix = prefix.upper()
key = os.environ[prefix + '_API_KEY']
secret = os.environ[prefix + '_API_SECRET']
passphrase = os.environ[prefix + '_API_PASS']
Expand Down Expand Up @@ -82,6 +83,14 @@ def str_to_order_type(s: str) -> OrderType:
return OrderType.NONE


@lru_cache(None)
def str_to_trade_result(s: str) -> TradeResult:
s = s.upper()
if s in ('OPEN',):
s = 'PENDING'
return TradeResult(s)


@lru_cache(None)
def str_to_exchange(exchange: str) -> ExchangeType:
if exchange.upper() not in ExchangeTypes:
Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
aiodns>=1.1.1
aiohttp>=3.5.4
aiostream>=0.3.1
ccxt>=1.18.529
cycler>=0.10.0
Expand Down

0 comments on commit f644b2d

Please sign in to comment.