Instantly share code, notes, and snippets.

View atrvsvol.py
from sysdata.quandl.quandl_futures import quandlFuturesConfiguration, quandlFuturesContractPriceData
from sysdata.futures.contracts import listOfFuturesContracts
from sysdata.futures.instruments import futuresInstrument
from sysdata.mongodb.mongo_roll_data import mongoRollParametersData
import numpy as np
import pandas as pd
def get_roll_parameters_from_mongo(instrument_code):
View temp.py
from systems.provided.futures_chapter15.basesystem import *
sys = futures_system()
config = sys.config
del(config.instrument_weights) # ensures all instruments are used equally weighted
config.forecast_weights=dict(ewmac16_64=0.333, ewmac32_128=0.333, ewmac64_256=0.3333)
config.use_forecast_div_mult_estimates=True
config.use_instrument_div_mult_estimates=True
config.use_forecast_scale_estimates=False
system = futures_system(config=config)
acc = system.accounts.portfolio()
View temp.py
# Gist example of IB wrapper ...
#
# Download API from http://interactivebrokers.github.io/#
#
# Install python API code /IBJts/source/pythonclient $ python3 setup.py install
#
# Note: The test cases, and the documentation refer to a python package called IBApi,
# but the actual package is called ibapi. Go figure.
#
# Get the latest version of the gateway:
View temp.py
# Gist example of IB wrapper ...
#
# Download API from http://interactivebrokers.github.io/#
#
# Install python API code /IBJts/source/pythonclient $ python3 setup.py install
#
# Note: The test cases, and the documentation refer to a python package called IBApi,
# but the actual package is called ibapi. Go figure.
#
# Get the latest version of the gateway:
View temp.py
# Gist example of IB wrapper ...
#
# Download API from http://interactivebrokers.github.io/#
#
# Install python API code /IBJts/source/pythonclient $ python3 setup.py install
#
# Note: The test cases, and the documentation refer to a python package called IBApi,
# but the actual package is called ibapi. Go figure.
#
# Get the latest version of the gateway:
View temp.py
# Gist example of IB wrapper ...
#
# Download API from http://interactivebrokers.github.io/#
#
# Install python API code /IBJts/source/pythonclient $ python3 setup.py install
#
# Note: The test cases, and the documentation refer to a python package called IBApi,
# but the actual package is called ibapi. Go figure.
#
# Get the latest version of the gateway:
View contractstrade.py
from syslogdiag.ourlogging import logger
from math import copysign
def contracts_trade(total_trades, pos_priced, pos_forward, rolling=False):
"""
Given actual contracts decide what to trade
Note at this stage contracts are identified in as PRICE, FORWARD
Any rogue contracts not in that space would have been signalled / weeded out by now
View IBaccountupdatenativepython.py
# Gist example of IB wrapper ...
#
# Download API from http://interactivebrokers.github.io/#
#
# Install python API code /IBJts/source/pythonclient $ python3 setup.py install
#
# Note: The test cases, and the documentation refer to a python package called IBApi,
# but the actual package is called ibapi. Go figure.
#
# Get the latest version of the gateway:
View scratchthis.py
# Gist example of IB wrapper ...
#
# Download API from http://interactivebrokers.github.io/#
#
# Install python API code /IBJts/source/pythonclient $ python3 setup.py install
#
# Note: The test cases, and the documentation refer to a python package called IBApi,
# but the actual package is called ibapi. Go figure.
#
# Get the latest version of the gateway:
View IBAPIpythonexample1.py
# Gist example of IB wrapper ...
#
# Download API from http://interactivebrokers.github.io/#
#
# Install python API code /IBJts/source/pythonclient $ python3 setup.py install
#
# Note: The test cases, and the documentation refer to a python package called IBApi,
# but the actual package is called ibapi. Go figure.
#
# Get the latest version of the gateway: