def __init__(self): ServicePlugin.__init__(self) self.markets = {} self.books = {} self.trade_history = {} self.ohlcv_history = {} self.safe_prices = {}
def register(self, endpoint, procedure=None, options=None): results = yield ServicePlugin.register(self, endpoint, procedure, options=RegisterOptions( details_arg="details", discloseCaller=True)) returnValue(results)
def init(self): yield ServicePlugin.init(self) self.db = self.require("sputnik.webserver.plugins.db.postgres.PostgresDatabase") self.administrator = self.require("sputnik.webserver.plugins.backend.administrator.AdministratorProxy") contracts = yield self.db.get_contracts() for contract in contracts: yield self.load_contract(contract) self.trade_history[contract] = yield self.db.get_trade_history(contract) # Clear ohlcv history self.ohlcv_history[contract] = {} # Fill ohlcv history for period in ["minute", "hour", "day"]: for trade in self.trade_history[contract]: self.update_ohlcv(trade, period=period)
def __init__(self): ServicePlugin.__init__(self)
def register(self, endpoint, procedure = None, options = None): results = yield ServicePlugin.register(self, endpoint, procedure, options=RegisterOptions(details_arg="details", discloseCaller=True)) returnValue(results)