Ejemplo n.º 1
0
 def __init__(self):
     self.ev = EventEngine()
     self.maker = BinanceFutures(self.ev)
     self.taker = Ftx(self.ev)
     self.maker_price = 0
     self.taker_price = 0
     self.data = []
     RepeatingTimer(1, self.savedb).start()
Ejemplo n.º 2
0
 def __init__(self, engine):
     super().__init__(engine)
     self.bar = {}
     self.t = {}
     cfg = config.exchange
     self.broker = BinanceFutures(cfg)
     self.symbols = cfg.symbols
     self.timeframe = cfg.timeframe
     self.update()
Ejemplo n.º 3
0
 def __init__(self, engine, setting):
     super().__init__(engine, setting)
     self.symbol=""
     self.kma_time=45
     self.rsi_time=14
     self.rsi_fastk=5
     self.rsi_fastd=3
     self.rsi_fastd_matype=0
     cfg=config.binance
     self.broker=BinanceFutures(cfg)
     self.symbol=cfg.symbol[0]
     self.timeframe="15m"
     self.qty=0.001
     self.bar=None
     self.tp=30.00
     self.sl=30.00
     RepeatingTimer(60, self.start).start()
Ejemplo n.º 4
0
 def __init__(self):
     self.ev = EventEngine()
     self.ev.start()
     self.broke = BinanceFutures(self.ev)
Ejemplo n.º 5
0
 def __init__(self):
     self.ev = EventEngine()
     self.ev.start()
     self.broke = BinanceFutures(self.ev)
     self.broke.start("btcusdt", [FORCEORDER])
     self.ev.register(FORCEORDER, self.callback)
Ejemplo n.º 6
0
import os, sys
baseroot = os.path.dirname(os.path.abspath(__file__))
sys.path.append('/alphaquant/')
from aq.broker.binancefutures import BinanceFutures
from aq.broker.huobi import HuobiFutures
from aq.common.constant import *
from aq.engine.baseStrategy import BaseStrategy
from aq.engine.config import config
from aq.common.logger import log
from aq.engine.event import EventEngine


def on_orderbook(msg):
    print(msg)


lcfg = config.long
scfg = config.short
ev = EventEngine()
long = BinanceFutures(ev)
subscribe = {ORDERBOOK: on_orderbook}
# long.subscribe(lcfg.symbols,subscribe)

short = HuobiFutures(ev)
short.subscribe((scfg.symbols, subscribe))
Ejemplo n.º 7
0
 def __init__(self, engine):
     super().__init__(engine)
     self.ev = engine
     cfg = config.short
     self.short = BinanceFutures(self.ev)
     self.long = HuobiFutures(self.ev)
Ejemplo n.º 8
0
from aq.broker.binancefutures import BinanceFutures
from aq.engine.event import EventEngine
import pandas as pd
ev = EventEngine()
b = BinanceFutures(ev)
bar = b.get_bar("BTCUSDT", "1m")
data = pd.DataFrame(bar)
data.to_csv("btcusdt1m.csv")