diff --git a/bfxapi/models/Order.py b/bfxapi/models/Order.py index e2a1532..28bf8f9 100644 --- a/bfxapi/models/Order.py +++ b/bfxapi/models/Order.py @@ -1,6 +1,22 @@ import time import datetime +class OrderType: + MARKET = 'market' + LIMIT = 'limit' + STOP = 'stop' + TRAILING_STOP = 'trailing-stop' + FILL_OR_KILL = 'fill-or-kill' + EXCHANGE_MARKET = 'exchange market' + EXCHANGE_LIMIT = 'exchange limit' + EXCHANGE_STOP = 'exchange stop' + EXCHANGE_TRAILING_STOP = 'exchange trailing-stop' + EXCHANGE_FILL_OR_KILL = 'exchange fill-or-kill' + +class OrderSide: + BUY = 'buy' + SELL = 'sell' + class OrderClosedModel: ID = 0 GID = 1 @@ -25,6 +41,30 @@ def now_in_mills(): return int(round(time.time() * 1000)) class Order: + """ + ID int64 Order ID + GID int Group ID + CID int Client Order ID + SYMBOL string Pair (tBTCUSD, …) + MTS_CREATE int Millisecond timestamp of creation + MTS_UPDATE int Millisecond timestamp of update + AMOUNT float Positive means buy, negative means sell. + AMOUNT_ORIG float Original amount + TYPE string The type of the order: LIMIT, MARKET, STOP, TRAILING STOP, EXCHANGE MARKET, EXCHANGE LIMIT, EXCHANGE STOP, EXCHANGE TRAILING STOP, FOK, EXCHANGE FOK. + TYPE_PREV string Previous order type + FLAGS int Upcoming Params Object (stay tuned) + ORDER_STATUS string Order Status: ACTIVE, EXECUTED, PARTIALLY FILLED, CANCELED + PRICE float Price + PRICE_AVG float Average price + PRICE_TRAILING float The trailing price + PRICE_AUX_LIMIT float Auxiliary Limit price (for STOP LIMIT) + HIDDEN int 1 if Hidden, 0 if not hidden + PLACED_ID int If another order caused this order to be placed (OCO) this will be that other order's ID + """ + + Type = OrderType() + Side = OrderSide() + def __init__(self, id, gId, cId, symbol, mtsCreate, mtsUpdate, amount, amountOrig, oType, typePrev, flags, status, price, priceAvg, priceTrailing, priceAuxLimit, notfiy, placeId): self.id = id diff --git a/bfxapi/models/Position.py b/bfxapi/models/Position.py index e8bcdf0..f012993 100644 --- a/bfxapi/models/Position.py +++ b/bfxapi/models/Position.py @@ -1,9 +1,20 @@ class Position: + """ + SYMBOL string Pair (tBTCUSD, …). + STATUS string Status (ACTIVE, CLOSED). + ±AMOUNT float Size of the position. Positive values means a long position, negative values means a short position. + BASE_PRICE float The price at which you entered your 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 + PL_PERC float Profit & Loss Percentage + PRICE_LIQ float Liquidation price + LEVERAGE float Beta value + """ def __init__(self, symbol, status, amount, bPrice, mFunding, mFundingType, profit_loss, profit_loss_perc, lPrice, lev): - # [['tBTCUSD', 'ACTIVE', -2.37709587, 20720, -0.00066105, 0, 13115.99728968, 26.6296139, 104156.986252, -1.2332]] self.symbol = symbol self.status = status self.amount = amount diff --git a/bfxapi/models/Trade.py b/bfxapi/models/Trade.py index bcb0e83..3ce8d3d 100644 --- a/bfxapi/models/Trade.py +++ b/bfxapi/models/Trade.py @@ -1,6 +1,20 @@ import datetime class Trade: + """ + ID integer Trade database id + PAIR string Pair (BTCUSD, …) + MTS_CREATE integer Execution timestamp + ORDER_ID integer Order id + EXEC_AMOUNT float Positive means buy, negative means sell + EXEC_PRICE float Execution price + ORDER_TYPE string Order type + ORDER_PRICE float Order price + MAKER int 1 if true, 0 if false + FEE float Fee + FEE_CURRENCY string Fee currency + """ + SHORT = 'SHORT' LONG = 'LONG'