def main(): parser = argparse.ArgumentParser( description='Script to calculate the features for Counter trades') parser.add_argument('--ifile', required=True, help='.xlsx files with the trades') parser.add_argument('--worksheet', required=True, help='Worksheet from --ifile that will be analyzed') parser.add_argument('--settingf', required=True, help='Path to .ini file with settings') parser.add_argument('--ser_data_f', help="Serialized file with candle data") args = parser.parse_args() logger.info("Creating TradeJournal") td = TradeJournal(url=args.ifile, worksheet=args.worksheet, settingf=args.settingf, ser_data_obj=ser_data_obj(ifile=args.ser_data_f)) logger.info("Done creating TradeJournal") trade_list = td.fetch_tradelist() logger.info("Analysing TradeList") trade_list.analyze() logger.info("Done TradeList") td.write_tradelist(trade_list)
def main(): parser = argparse.ArgumentParser(description='Trading bot') parser.add_argument('--pair', required=True, help="Pair to be analysed: EUR_GBP") parser.add_argument('--timeframe', required=True, help="Timeframe used: i.e. 'D', 'H12', 'H8'") parser.add_argument('--start', required=True, help="Start time for this bot: i.e. 2019-08-12 22:00:00") parser.add_argument('--end', required=True, help="End time for this bot: i.e. 2019-08-19 22:00:00") parser.add_argument('--url', required=True, help=".xlsx file used to write the Trades taken") parser.add_argument('--ser_data_f', help="Serialized file with candle data") parser.add_argument('--settingf', required=True, help='Path to .ini file with settings') args = parser.parse_args() tb = TradeBot( pair=args.pair, timeframe=args.timeframe, start=args.start, end=args.end, ser_data_f=args.ser_data_f, settingf=args.settingf) main_logger.info("Running TradeBot") pickled_file = "{0}.pckl".format(os.path.basename(args.url).split('.')[0]) tl = tb.run(pickled_file=pickled_file) main_logger.info("Done TradeBot") if tl is not None: td = TradeJournal(url=args.url, worksheet="trading_journal", settingf=args.settingf) td.write_tradelist(tl) else: main_logger.info("No trades found. No worksheet will be created in tradejournal")
def tlist_o(): '''Returns a TradeList object using the trade_journal.fetch_tradelist() function''' td = TradeJournal(url="../../data/testCounter.xlsx", worksheet="trading_journal", settingf="../../data/settings.ini") trade_list = td.fetch_tradelist() return trade_list
def main(): parser = argparse.ArgumentParser(description='Script to calculate the features for Counter trades') parser.add_argument('--ifile', required=True, help='.xlsx files with the trades') parser.add_argument('--worksheet', required=True, help='Worksheet from --ifile that will be analyzed') parser.add_argument('--settingf', required=True, help='Path to .ini file with settings') args = parser.parse_args() td = TradeJournal(url=args.ifile, worksheet=args.worksheet, settingf=args.settingf) trade_list = td.fetch_tradelist() trade_list.analyze() td.write_tradelist(trade_list)
def tjO(): '''Returns a trade_journal object for a Counter trade''' td = TradeJournal(url="../../data/testCounter.xlsx", worksheet="trading_journal", settingf="../../data/settings.ini") return td
def test_tj_nonexists(clean_tmp): '''Instantiates a trade_journal object when the .xlsx pointed by url does not exist''' fname = Path("../../data/testCounter1.xlsx") td = TradeJournal(url=fname, worksheet="trading_journal", settingf="../../data/settings.ini") # check that fname has been initialized assert fname.exists() is True
import argparse import pdb from trade_journal.trade_journal import TradeJournal parser = argparse.ArgumentParser( description='Script to calculate some basic stats on the Trading journal') parser.add_argument('--ifile', required=True, help='.xlsx files with the trades') parser.add_argument('--sheet', required=True, help='Worksheet in the .xlsx that will be analyzed') parser.add_argument('--strat', required=False, help='Trade strat that will be analyzed') parser.add_argument('--wsname', required=False, help='Worksheet name') args = parser.parse_args() td = TradeJournal(url=args.ifile, worksheet=args.sheet) (prop, pips, number) = td.print_winrate(strat=args.strat, write_xlsx=True, worksheet_name=args.wsname) print("Total number of records:\n{0}".format(number)) print("Proportion:\n{0}".format(prop)) print("Sum of pips:{0}".format(pips))
import argparse import logging import argparse import pdb from trade_journal.trade_journal import TradeJournal parser = argparse.ArgumentParser( description='calc win rate on a Trading journal') parser.add_argument('--tj', required=True, help=".xlsx file containing the Trading Journal") parser.add_argument('--ws', required=True, help="Worksheet in --tj to be analysed") parser.add_argument('--strats', required=True, help="Comma-separated list of strategies to analyse: i.e." "counter,counter_b1") parser.add_argument('--settingf', required=True, help='Path to .ini file with settings') args = parser.parse_args() td = TradeJournal(url=args.tj, worksheet=args.ws, settingf=args.settingf) trade_list = td.fetch_tradelist() trade_list.win_rate(strats=args.strats)