-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtemp.py
More file actions
55 lines (47 loc) · 1.74 KB
/
Copy pathtemp.py
File metadata and controls
55 lines (47 loc) · 1.74 KB
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
from database.database import Company, Trader, SplitHistory, StockList, StockListDatum
from sqlalchemy import create_engine, and_, distinct
from sqlalchemy.orm import sessionmaker
import datetime
import app_config
from database.price_history import insert_price_history
from database.simulation import add_simulation, get_transactions
from database.database import SimulationTrader
from pub.simulation.capital_gains import get_capital_gains
import price_history_manager
import tools
import math
import pprint
import json
import os
import random
import shutil
from traders.simple_trader import SimpleTraderSchema
from marshmallow_jsonschema import JSONSchema
from traders import util
def main():
# engine = create_engine('{}://{}:{}@{}/{}'.format(app_config.DB_TYPE, app_config.DB_USER, app_config.DB_PASS, app_config.DB_HOST, app_config.DB_NAME))
# engine.connect()
# Session = sessionmaker(bind=engine)
# session = Session()
import git
temp = 'tmp'
pathname = '{}/repo{}'.format(temp, random.randint(100000, 1000000))
if not os.path.exists(temp):
os.mkdir(temp)
os.mkdir(pathname)
print("Download to {}".format(pathname))
git.Git(pathname).clone("git@github.com:rtaft/my-stock-traders.git")
#files = os.listdir(pathname)
trader_files = []
existing_files = []
#for pathname in files:
for root, dirs, files in os.walk(pathname, topdown=False):
for filename in files:
if filename[-3:] == '.py':
fullpath = os.path.join(root, filename)
print(fullpath)
print(util.is_trader_instance(fullpath[:-3].replace('/', '.')))
#trader_files.append(filename)
shutil.rmtree(pathname)
if __name__ == "__main__":
main()