forked from sjev/twp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
23,471 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() |
Oops, something went wrong.