def __init__(self): args = self.arg_parser.parse_known_args()[0] self.blueprint_days = args.days self.ticker_size = int(args.ticker_size) self.blueprint_end_time = int(time.time()) self.start_time = self.blueprint_end_time - int( self.blueprint_days) * 86400 self.ticker_epoch = self.start_time self.exchange = Exchange(None) self.pairs = common.parse_pairs(self.exchange, args.pairs) blueprints_module = common.load_module('ai.blueprints.', args.features) self.blueprint = blueprints_module(self.pairs) self.max_buffer_size = int( int(args.buffer_size) * (1440 / self.ticker_size) * len(self.pairs)) self.df_buffer = pd.DataFrame() self.df_blueprint = pd.DataFrame() self.output_dir = args.output_dir self.export_file_name = self.get_output_file_path( self.output_dir, self.blueprint.name) self.export_file_initialized = False # Crete output dir if not os.path.exists(self.out_dir): os.makedirs(self.out_dir)
def __init__(self): self.args = self.arg_parser.parse_known_args()[0] print( colored('Starting lense on exchange: ' + self.args.exchange, 'yellow')) self.exchange = Exchange() self.postman = Postman()
def __init__(self, trade_mode): super(Base, self).__init__() self.args = self.arg_parser.parse_known_args()[0] self.exchange = Exchange(trade_mode) self.transaction_fee = self.exchange.get_transaction_fee() self.ticker_df = pd.DataFrame() self.verbosity = self.args.verbosity self.pairs = common.parse_pairs(self.exchange, self.args.pairs) self.fixed_trade_amount = float(self.args.fixed_trade_amount) self.pair_delimiter = self.exchange.get_pair_delimiter() self.last_tick_epoch = 0
def __init__(self, args, config_file, trade_mode): super(Base, self).__init__() self.args = args self.config = self.initialize_config(config_file) self.exchange = Exchange(args, config_file, trade_mode) self.transaction_fee = self.exchange.get_transaction_fee() self.ticker_df = pd.DataFrame() self.verbosity = int(self.config['General']['verbosity']) self.pairs = self.process_input_pairs(self.config['Trade']['pairs']) self.pair_delimiter = self.exchange.get_pair_delimiter() self.last_tick_epoch = 0
def trade_history(): """ Gets sample trades history """ exchange = Exchange() end = time.time() start = end - 3600 data = exchange.get_market_history(start=start, end=end, currency_pair='BTC_ETH') print(data)
def __init__(self, trade_mode): super(Base, self).__init__( ) #crea con init di ABC. ABC è una classe che aiuta a costruire per ereditarietà self.args = self.arg_parser.parse_known_args()[0] self.exchange = Exchange(trade_mode) self.transaction_fee = self.exchange.get_transaction_fee() self.ticker_df = pd.DataFrame() self.verbosity = self.args.verbosity self.pairs = common.parse_pairs(self.exchange, self.args.pairs) self.fixed_trade_amount = float(self.args.fixed_trade_amount) self.pair_delimiter = self.exchange.get_pair_delimiter() self.last_tick_epoch = 0
def __init__(self): super(Base, self).__init__() args = self.arg_parser.parse_known_args()[0] self.exchange = Exchange() self.exchange_name = self.exchange.get_exchange_name() self.db = self.initialize_db(args)