models: linting

This commit is contained in:
JacobPlaster
2020-04-14 16:17:39 +01:00
committed by Jacob Plaster
parent 63c7fc3d23
commit 554c8c6112
3 changed files with 18 additions and 10 deletions

View File

@@ -25,7 +25,8 @@ class FundingTickerModel:
class FundingTicker:
"""
FRR float Flash Return Rate - average of all fixed rate funding over the last hour (funding tickers only)
FRR float Flash Return Rate - average of all fixed rate funding over the last hour
(funding tickers only)
BID float Price of last highest bid
BID_PERIOD int Bid period covered in days (funding tickers only)
BID_SIZE float Sum of the 25 highest bid sizes
@@ -33,12 +34,14 @@ class FundingTicker:
ASK_PERIOD int Ask period covered in days (funding tickers only)
ASK_SIZE float Sum of the 25 lowest ask sizes
DAILY_CHANGE float Amount that the last price has changed since yesterday
DAILY_CHANGE_RELATIVE float Relative price change since yesterday (*100 for percentage change)
DAILY_CHANGE_RELATIVE float Relative price change since yesterday
(*100 for percentage change)
LAST_PRICE float Price of the last trade
VOLUME float Daily volume
HIGH float Daily high
LOW float Daily low
FRR_AMOUNT_AVAILABLE float The amount of funding that is available at the Flash Return Rate (funding tickers only)
FRR_AMOUNT_AVAILABLE float The amount of funding that is available at the
Flash Return Rate (funding tickers only)
"""
def __init__(self, pair, frr, bid, bid_period, bid_size, ask, ask_period, ask_size,
@@ -64,7 +67,8 @@ class FundingTicker:
"""
Generate a Ticker object from a raw ticker array
"""
# [72128,[6914.5,28.123061460000002,6914.6,22.472037289999996,175.8,0.0261,6915.7,6167.26141685,6964.2,6710.8]]
# [72128,[6914.5,28.123061460000002,6914.6,22.472037289999996,175.8,0.0261,6915.7,
# 6167.26141685,6964.2,6710.8]]
return FundingTicker(
pair,

View File

@@ -30,8 +30,10 @@ class Position:
"""
SYMBOL string Pair (tBTCUSD, …).
STATUS string Status (ACTIVE, CLOSED).
±AMOUNT float Size of the position. A positive value indicates a long position; a negative value indicates a short position.
BASE_PRICE float Base price of the position. (Average traded price of the previous orders of the position)
±AMOUNT float Size of the position. A positive value indicates a
long position; a negative value indicates a short position.
BASE_PRICE float Base price of the position. (Average traded price
of the previous orders of the position)
MARGIN_FUNDING float The amount of funding being used for this position.
MARGIN_FUNDING_TYPE int 0 for daily, 1 for term.
PL float Profit & Loss
@@ -41,14 +43,15 @@ class Position:
POSITION_ID int64 Position ID
MTS_CREATE int Millisecond timestamp of creation
MTS_UPDATE int Millisecond timestamp of update
TYPE int Identifies the type of position, 0 = Margin position, 1 = Derivatives position
TYPE int Identifies the type of position, 0 = Margin position,
1 = Derivatives position
COLLATERAL float The amount of collateral applied to the open position
COLLATERAL_MIN float The minimum amount of collateral required for the position
META json string Additional meta information about the position
"""
def __init__(self, symbol, status, amount, b_price, m_funding, m_funding_type,
profit_loss, profit_loss_perc, l_price, lev, id, mts_create, mts_update,
profit_loss, profit_loss_perc, l_price, lev, pid, mts_create, mts_update,
p_type, collateral, collateral_min, meta):
self.symbol = symbol
self.status = status
@@ -60,7 +63,7 @@ class Position:
self.profit_loss_percentage = profit_loss_perc
self.liquidation_price = l_price
self.leverage = lev
self.id = id
self.id = pid
self.mts_create = mts_create
self.mts_update = mts_update
self.type = p_type

View File

@@ -50,7 +50,8 @@ class Ticker:
"""
Generate a Ticker object from a raw ticker array
"""
# [72128,[6914.5,28.123061460000002,6914.6,22.472037289999996,175.8,0.0261,6915.7,6167.26141685,6964.2,6710.8]]
# [72128,[6914.5,28.123061460000002,6914.6,22.472037289999996,175.8,0.0261,6915.7,
# 6167.26141685,6964.2,6710.8]]
return Ticker(
pair,