-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.py
74 lines (46 loc) · 1.76 KB
/
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# import logging
# logging.basicConfig(filename='testing/test.log', format='[%(asctime)s] - %(levelname)s - {%(filename)s:%(lineno)d} - %(name)s - %(message)s', datefmt='%Y-%m-%d:%H:%M:%S')
# def do():
# from testing.components.tester import data_getter as dg, Iterator
# currency = 'USDT'
# symbol = ['BTC', 'ETH']
# interval = '1h'
# start = '1 1 2020'
# end = '1 1 2021'
# strat = 4
# risk = 3
# cap = 100
# iterator = Iterator(currency, symbol, interval, start, end)
# iterator.run( cap ,risk,strat)
def trades_analitics():
import os, sys, json
tradesPath = "instance.db/trades"
tradeFilePaths = os.listdir(tradesPath)
tradesForFile = []
for path in tradeFilePaths:
with open( f"{tradesPath}/{path}" , "r") as f:
tradesForFile.append( json.loads(f.read()) )
count = sumOfGains = 0
for trades in tradesForFile:
for trade in trades:
# if trade['in_order']['symbol'] == 'BTCUSDT':
sumOfGains += trade['gain']
count += 1
print("count is : ",count)
print("sum of gains is : ", sumOfGains)
import sys, time, json
from tradingTest import strategy
import binanceWrapper as binance
if __name__ == "__main__":
from tradingTest import utils, technicalAnalisys as ta, TradingTest
# strategy.rideLong.setup(binance.symbolKlines('BTCUSDT', '1h'))
# exit()
end = utils.dayMonthYearTime("21 nov 2021")
now = time.time()
props = {"symbol" : "ETHUSDT", "interval" : "1h", "startTime" : utils.yearTime("2010"), "endTime" : end}
tester = TradingTest()
tester.test(props)
# analytics = tester.tradeAnalytics()
# print()
# for x in analytics:
# print(x, analytics[x])