Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
timkpaine committed Dec 27, 2019
1 parent 75fcb80 commit 957d847
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,10 @@ test_verbose: ## run the tests with full output
@ python3 -m pytest -vv ./aat/tests --cov=aat

lint: ## run linter
flake8 aat
python3 -m flake8 aat

fix: ## run autopep8/tslint fix
autopep8 --in-place -r -a -a aat/
python3 -m autopep8 --in-place -r -a -a aat/

annotate: ## MyPy type annotation check
mypy -s aat
Expand Down
12 changes: 7 additions & 5 deletions aat/query.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from functools import reduce
from typing import List, Dict
from .enums import TradeResult, ExchangeType, PairType, CurrencyType, TradingType, Side
from .exceptions import QueryException
from .exceptions import QueryException, AATException
from .execution import Execution
from .logging import log
from .risk import Risk
Expand Down Expand Up @@ -266,8 +266,10 @@ def _recalculate_positions(self, data: MarketData) -> None:
return

volume = self.positions[data.instrument]._volume
instrument = str(data.instrument)
value = self.positions[data.instrument]._avg_price * volume
# instrument = str(data.instrument)
_ = str(data.instrument)
# value = self.positions[data.instrument]._avg_price * volume
_ = self.positions[data.instrument]._avg_price * volume
pnl = self.positions[data.instrument]._pnl

# get PnL numbers
Expand Down Expand Up @@ -310,8 +312,8 @@ def _ticker(self, currency: CurrencyType, exchange):
inst1_t = self.query_lastprice(instrument=inst1).price
inst2_t = self.query_lastprice(instrument=inst2).price
if i1_inverted:
inst1_t = 1.0/inst1_t
inst1_t = 1.0 / inst1_t
if i2_inverted:
inst2_t = 1.0/inst2_t
inst2_t = 1.0 / inst2_t
px = inst1_t * inst2_t
return px
3 changes: 2 additions & 1 deletion aat/strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def onAnalyze(self, engine):
# format into pandas
pd = pandas.DataFrame(positions_value, columns=['time', 'unrealized', 'realized', 'pnl'])
pd2 = pandas.DataFrame(portfolio_value, columns=['time', 'value'])
import ipdb; ipdb.set_trace()
import ipdb
ipdb.set_trace()
pd.set_index(['time'], inplace=True)
pd2.set_index(['time'], inplace=True)

Expand Down
1 change: 1 addition & 0 deletions aat/ui/handlers/login.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import tornado
from .base import HTTPHandler
from ...logging import log


class LoginHandler(HTTPHandler):
Expand Down
4 changes: 2 additions & 2 deletions aat/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ def __init__(self):
self._avg_price = self._px

def price(self, px):
self._pnl = (self._volume * (px-self._avg_price))
self._records.append({'volume': self._volume, 'px': px, 'apx': self._avg_price, 'pnl': self._pnl+self._realized, 'unrealized': self._pnl, 'realized': self._realized})
self._pnl = (self._volume * (px - self._avg_price))
self._records.append({'volume': self._volume, 'px': px, 'apx': self._avg_price, 'pnl': self._pnl + self._realized, 'unrealized': self._pnl, 'realized': self._realized})

def exec(self, amt, px, side):
if self._px is None:
Expand Down

0 comments on commit 957d847

Please sign in to comment.