MikePia / structjour

A tool to automate the daily review of trades
GNU General Public License v3.0
41 stars 9 forks source link

Pls add one model ib statement #6

Open kamaleshvm opened 4 years ago

kamaleshvm commented 4 years ago

Please add one model ib statement or the header , so that i can modify the code for India equity market. Thanks in advance.

MikePia commented 4 years ago

Sorry I have been absent from github for a while. The program will already read IB statements. I am retaining only csv activity and flex activity statements in the program. This is pre alpha and the the interface will definitely change but I will be sure to leave the current stuff in place at least until beta release. I plan to abstract the database models using django db models or something similar that will enable any database to be used. But for now

# The infile could be an Activity statement or a flex activity statment
# This file on my system is one month of trades from a flex statment

infile = "flex.369463.ActivityFlexMonth.20191008.20191106.csv"
theDate = pd.Timestamp('2019-10-16')

# Create these two objects
ibs = IbStatement(db="testdb.sqlite")
ibdb = StatementDB("testdb.sqlite")

# This call loads the statement into the db
ibs.openIBStatementCSV(infile)     

# This call will then retrieve one day of transactions organized as trades. theDate is string or timestamp
df2 = ibdb.getStatement(theDate)   

Currently StatemenDB object loads up US holidays. Maybe that should change to a pluggable set of holidays?

kamaleshvm commented 4 years ago

Thanks for your response. I will check and response to you.