Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
class BinanceTimeFrames(MultiValueEnum):
ONE_MINUTE = Client.KLINE_INTERVAL_1MINUTE, TimeFrames.ONE_MINUTE
FIVE_MINUTES = Client.KLINE_INTERVAL_5MINUTE, TimeFrames.FIVE_MINUTES
THIRTY_MINUTES = Client.KLINE_INTERVAL_30MINUTE, TimeFrames.THIRTY_MINUTES
ONE_HOUR = Client.KLINE_INTERVAL_1HOUR, TimeFrames.ONE_HOUR
TWO_HOURS = Client.KLINE_INTERVAL_2HOUR, TimeFrames.TWO_HOURS
FOUR_HOURS = Client.KLINE_INTERVAL_4HOUR, TimeFrames.FOUR_HOURS
ONE_DAY = Client.KLINE_INTERVAL_1DAY, TimeFrames.ONE_DAY
THREE_DAYS = Client.KLINE_INTERVAL_3DAY, TimeFrames.THREE_DAYS
ONE_WEEK = Client.KLINE_INTERVAL_1WEEK, TimeFrames.ONE_WEEK
ONE_MONTH = Client.KLINE_INTERVAL_1MONTH, TimeFrames.ONE_MONTH
class BinanceOrderType(MultiValueEnum):
BUY_MARKET = frozenset([Client.SIDE_BUY, Client.ORDER_TYPE_MARKET]), TraderOrderType.BUY_MARKET
BUY_LIMIT = frozenset([Client.SIDE_BUY, Client.ORDER_TYPE_LIMIT]), TraderOrderType.BUY_LIMIT
TAKE_PROFIT = frozenset([Client.SIDE_SELL, Client.ORDER_TYPE_TAKE_PROFIT]), TraderOrderType.TAKE_PROFIT
TAKE_PROFIT_LIMIT = frozenset(
[Client.SIDE_SELL, Client.ORDER_TYPE_TAKE_PROFIT_LIMIT]), TraderOrderType.TAKE_PROFIT_LIMIT
STOP_LOSS = frozenset([Client.SIDE_SELL, Client.ORDER_TYPE_STOP_LOSS]), TraderOrderType.STOP_LOSS
STOP_LOSS_LIMIT = frozenset([Client.SIDE_SELL, Client.ORDER_TYPE_STOP_LOSS_LIMIT]), TraderOrderType.STOP_LOSS_LIMIT
SELL_MARKET = frozenset([Client.SIDE_SELL, Client.ORDER_TYPE_MARKET]), TraderOrderType.SELL_MARKET
SELL_LIMIT = frozenset([Client.SIDE_SELL, Client.ORDER_TYPE_LIMIT]), TraderOrderType.SELL_LIMIT
result = []
data = self.client.get_recent_trades(symbol=self.parse_symbol(symbol))
for d in data:
result.append({
"price": d["price"],
"quantity": d["qty"],
"time": d["time"],
"buyer": d["isBuyerMaker"]
})
return result
def get_all_orders(self):
self.client.get_all_orders()
class BinanceTimeFrames(MultiValueEnum):
ONE_MINUTE = Client.KLINE_INTERVAL_1MINUTE, TimeFrames.ONE_MINUTE
FIVE_MINUTES = Client.KLINE_INTERVAL_5MINUTE, TimeFrames.FIVE_MINUTES
THIRTY_MINUTES = Client.KLINE_INTERVAL_30MINUTE, TimeFrames.THIRTY_MINUTES
ONE_HOUR = Client.KLINE_INTERVAL_1HOUR, TimeFrames.ONE_HOUR
TWO_HOURS = Client.KLINE_INTERVAL_2HOUR, TimeFrames.TWO_HOURS
FOUR_HOURS = Client.KLINE_INTERVAL_4HOUR, TimeFrames.FOUR_HOURS
ONE_DAY = Client.KLINE_INTERVAL_1DAY, TimeFrames.ONE_DAY
THREE_DAYS = Client.KLINE_INTERVAL_3DAY, TimeFrames.THREE_DAYS
ONE_WEEK = Client.KLINE_INTERVAL_1WEEK, TimeFrames.ONE_WEEK
ONE_MONTH = Client.KLINE_INTERVAL_1MONTH, TimeFrames.ONE_MONTH
class BinanceOrderType(MultiValueEnum):
BUY_MARKET = frozenset([Client.SIDE_BUY, Client.ORDER_TYPE_MARKET]), TraderOrderType.BUY_MARKET
BUY_LIMIT = frozenset([Client.SIDE_BUY, Client.ORDER_TYPE_LIMIT]), TraderOrderType.BUY_LIMIT
TAKE_PROFIT = frozenset([Client.SIDE_SELL, Client.ORDER_TYPE_TAKE_PROFIT]), TraderOrderType.TAKE_PROFIT