Skip to content

Commit

Permalink
added files
Browse files Browse the repository at this point in the history
  • Loading branch information
sjev committed Feb 14, 2021
1 parent a83b449 commit 76e3853
Show file tree
Hide file tree
Showing 30 changed files with 23,471 additions and 0 deletions.
46 changes: 46 additions & 0 deletions common.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
"""
Common code for reuse in notebooks
"""


def systemInfo():
""" print versions of most important modules """
import imp

modules = ['tradingWithPython','pandas','ibapi','ib']


for name in modules:
print(5*'-',name,5*'-')
try:
result = imp.find_module(name)
except ImportError as e:
print(e)
continue

pkg = imp.load_module(name,*result)
print('Version: ',pkg.__version__)
print('Location:', pkg.__file__)

def prettifyNotebook(figsize=[8,6], max_rows=10, precision=2):
"""
cosmetic tweaks to make notebook look pretty
"""
import matplotlib.pyplot as plt
plt.style.use('ggplot')

# bigger fitures
import matplotlib
matplotlib.rcParams['figure.figsize'] = figsize

# limint number of rows shown by pandas
import pandas as pd
pd.options.display.max_rows = max_rows

# set two-digit precision, we usually don't need more for financial data
pd.options.display.precision = precision


if __name__=="__main__":
#systemInfo()
prettifyNotebook()
Loading

0 comments on commit 76e3853

Please sign in to comment.