本文整理汇总了Python中sysdata.csvdata.csvFuturesData函数的典型用法代码示例。如果您正苦于以下问题:Python csvFuturesData函数的具体用法?Python csvFuturesData怎么用?Python csvFuturesData使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了csvFuturesData函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: testRules
def testRules(self):
# config=Config(dict(trading_rules=dict(ewmac=dict(function="systems.provided.example.rules.ewmac_forecast_with_defaults"))))
data = csvFuturesData("sysdata.tests")
rules = Rules(
dict(function="systems.provided.example.rules.ewmac_forecast_with_defaults"))
system = System([rules], data)
ans = system.rules.get_raw_forecast("EDOLLAR", "rule0")
self.assertAlmostEqual(ans.iloc[-1][0], 2.1384223788141838, 5)
config = Config(dict(trading_rules=dict(ewmac=dict(
function="systems.provided.example.rules.ewmac_forecast_with_defaults"))))
rules = Rules()
system = System([rules], data, config)
ans = system.rules.get_raw_forecast("EDOLLAR", "ewmac")
self.assertAlmostEqual(ans.iloc[-1][0], 0.542369955, 5)
config = Config("systems.provided.example.exampleconfig.yaml")
rawdata = RawData()
rules = Rules()
system = System([rules, rawdata], data, config)
ans = system.rules.get_raw_forecast("EDOLLAR", "ewmac8")
self.assertAlmostEqual(ans.iloc[-1][0], 0.16438313875, 5)
开发者ID:rlcjj,项目名称:pysystemtrade,代码行数:26,代码来源:test_forecasts.py
示例2: futures_system
def futures_system(data=None, config=None, trading_rules=None, log_level="terse"):
"""
:param data: data object (defaults to reading from csv files)
:type data: sysdata.data.Data, or anything that inherits from it
:param config: Configuration object (defaults to futuresconfig.yaml in this directory)
:type config: sysdata.configdata.Config
:param trading_rules: Set of trading rules to use (defaults to set specified in config object)
:param trading_rules: list or dict of TradingRules, or something that can be parsed to that
:param log_level: Set of trading rules to use (defaults to set specified in config object)
:type log_level: str
"""
if data is None:
data = csvFuturesData()
if config is None:
config = Config(
"systems.provided.futures_chapter15.futuresestimateconfig.yaml")
rules = Rules(trading_rules)
system = System([Account(), Portfolios(), PositionSizing(), FuturesRawData(), ForecastCombine(),
ForecastScaleCap(), rules], data, config)
system.set_logging_level(log_level)
return system
开发者ID:caitouwh,项目名称:kod,代码行数:32,代码来源:estimatedsystem.py
示例3: get_test_object_futures
def get_test_object_futures():
"""
Returns some standard test data
"""
data = csvFuturesData("sysdata.tests")
config = Config("systems.provided.example.exampleconfig.yaml")
return ( data, config)
开发者ID:caitouwh,项目名称:kod,代码行数:7,代码来源:testfuturesrawdata.py
示例4: testCallingTradingRule
def testCallingTradingRule(self):
# config=Config(dict(trading_rules=dict(ewmac=dict(function="systems.provided.example.rules.ewmac_forecast_with_defaults"))))
data = csvFuturesData("sysdata.tests")
rawdata = RawData()
rules = Rules()
system = System([rawdata, rules], data)
# Call with default data and config
rule = TradingRule(ewmac_forecast_with_defaults)
ans = rule.call(system, "EDOLLAR")
self.assertAlmostEqual(ans.iloc[-1][0], 2.1384223788141838, 5)
# Change the data source
rule = TradingRule(("systems.provided.example.rules.ewmac_forecast_with_defaults_no_vol",
["rawdata.daily_prices", "rawdata.daily_returns_volatility"], dict()))
ans = rule.call(system, "EDOLLAR")
self.assertAlmostEqual(ans.iloc[-1][0], 0.029376, 5)
rule = TradingRule(dict(function="systems.provided.example.rules.ewmac_forecast_with_defaults_no_vol",
data=["rawdata.daily_prices",
"rawdata.daily_returns_volatility"],
other_args=dict(Lfast=50, Lslow=200)))
ans = rule.call(system, "EDOLLAR")
self.assertAlmostEqual(ans.iloc[-1][0], 3.84426755)
开发者ID:rlcjj,项目名称:pysystemtrade,代码行数:27,代码来源:test_forecasts.py
示例5: get_test_object_futures_with_rules
def get_test_object_futures_with_rules():
"""
Returns some standard test data
"""
data = csvFuturesData("sysdata.tests")
rawdata = FuturesRawData()
rules = Rules()
config = Config("systems.provided.example.exampleconfig.yaml")
return (rules, rawdata, data, config)
开发者ID:Futurequant,项目名称:pysystemtrade,代码行数:9,代码来源:testdata.py
示例6: testCarryRule
def testCarryRule(self):
data = csvFuturesData("sysdata.tests")
rawdata = FuturesRawData()
rules = Rules()
system = System([rawdata, rules], data)
rule=TradingRule(carry, ["rawdata.daily_annualised_roll", "rawdata.daily_returns_volatility"], dict(smooth_days=90))
ans = rule.call(system, "EDOLLAR")
self.assertAlmostEqual(ans.iloc[-1][0], 0.411686026, 5)
开发者ID:Futurequant,项目名称:pysystemtrade,代码行数:9,代码来源:test_forecasts.py
示例7: get_test_object_futures_with_rules_and_capping
def get_test_object_futures_with_rules_and_capping():
"""
Returns some standard test data
"""
data = csvFuturesData("sysdata.tests")
rawdata = FuturesRawData()
rules = Rules()
config = Config("systems.provided.example.exampleconfig.yaml")
capobject = ForecastScaleCapFixed()
return (capobject, rules, rawdata, data, config)
开发者ID:Futurequant,项目名称:pysystemtrade,代码行数:10,代码来源:testdata.py
示例8: futures_system
def futures_system(data=None, config=None, trading_rules=None, log_level="on"):
"""
:param data: data object (defaults to reading from csv files)
:type data: sysdata.data.Data, or anything that inherits from it
:param config: Configuration object (defaults to futuresconfig.yaml in this directory)
:type config: sysdata.configdata.Config
:param trading_rules: Set of trading rules to use (defaults to set specified in config object)
:type trading_rules: list or dict of TradingRules, or something that can be parsed to that
:param log_level: How much logging to do
:type log_level: str
>>> system=futures_system(log_level="off")
>>> system
System with stages: accounts, portfolio, positionSize, rawdata, combForecast, forecastScaleCap, rules
>>> system.rules.get_raw_forecast("EDOLLAR", "ewmac2_8").dropna().head(2)
ewmac2_8
1983-10-10 0.695929
1983-10-11 -0.604704
ewmac2_8
2015-04-21 0.172416
2015-04-22 -0.477559
>>> system.rules.get_raw_forecast("EDOLLAR", "carry").dropna().head(2)
carry
1983-10-10 0.952297
1983-10-11 0.854075
carry
2015-04-21 0.350892
2015-04-22 0.350892
"""
if data is None:
data = csvFuturesData()
if config is None:
config = Config(
"systems.provided.futures_chapter15.futuresconfig.yaml")
rules = Rules(trading_rules)
system = System([
Account(), Portfolios(), PositionSizing(), FuturesRawData(),
ForecastCombine(), ForecastScaleCap(), rules
], data, config)
system.set_logging_level(log_level)
return system
开发者ID:kohehir,项目名称:pysystemtrade,代码行数:54,代码来源:basesystem.py
示例9: get_test_object_futures_with_pos_sizing
def get_test_object_futures_with_pos_sizing():
"""
Returns some standard test data
"""
data = csvFuturesData("sysdata.tests")
rawdata = FuturesRawData()
rules = Rules()
config = Config("systems.provided.example.exampleconfig.yaml")
capobject = ForecastScaleCapFixed()
combobject = ForecastCombineFixed()
posobject = PositionSizing()
return (posobject, combobject, capobject, rules, rawdata, data, config)
开发者ID:Futurequant,项目名称:pysystemtrade,代码行数:12,代码来源:testdata.py
示例10: simplesystem
def simplesystem(data=None, config=None):
"""
Example of how to 'wrap' a complete system
"""
if config is None:
config = Config("systems.provided.example.simplesystemconfig.yaml")
if data is None:
data = csvFuturesData()
my_system = System([Account(), PortfoliosFixed(), PositionSizing(), ForecastCombineFixed(), ForecastScaleCapFixed(), Rules()
], data, config)
return my_system
开发者ID:as4724,项目名称:pysystemtrade,代码行数:13,代码来源:simplesystem.py
示例11: futures_system
def futures_system(data=None, config=None, trading_rules=None):
"""
:param data: data object (defaults to reading from csv files)
:type data: sysdata.data.Data, or anything that inherits from it
:param config: Configuration object (defaults to futuresconfig.yaml in this directory)
:type config: sysdata.configdata.Config
:param trading_rules: Set of trading rules to use (defaults to set specified in config object)
:param trading_rules: list or dict of TradingRules, or something that can be parsed to that
>>> system=futures_system()
>>> system
System with stages: accounts, portfolio, positionSize, rawdata, combForecast, forecastScaleCap, rules
>>> system.rules.get_raw_forecast("EDOLLAR", "ewmac2_8").tail(2)
ewmac2_8
2015-04-21 0.172416
2015-04-22 -0.477559
>>> system.rules.get_raw_forecast("EDOLLAR", "carry").tail(2)
carry
2015-04-21 0.350892
2015-04-22 0.350892
"""
if data is None:
data = csvFuturesData()
if config is None:
config = Config(
"systems.provided.futures_chapter15.futuresconfig.yaml")
rules = Rules(trading_rules)
system = System([Account(), PortfoliosFixed(), PositionSizing(), FuturesRawData(), ForecastCombineFixed(),
ForecastScaleCapFixed(), rules], data, config)
return system
开发者ID:as4724,项目名称:pysystemtrade,代码行数:38,代码来源:basesystem.py
示例12: csvFuturesData
"""
# Get some data
from sysdata.csvdata import csvFuturesData
""""
Let's get some data
We can get data from various places; however for now we're going to use prepackaged 'legacy' data stored
in csv files
"""
data = csvFuturesData()
print(data)
"""
We get stuff out of data with methods
"""
print(data.get_instrument_list())
print(data.get_daily_price("EDOLLAR").tail(5))
"""
data can also behave in a dict like manner (though it's not a dict)
"""
print(data['SP500'])
开发者ID:rlcjj,项目名称:pysystemtrade,代码行数:30,代码来源:asimpletradingrule.py
示例13: csvFuturesData
return combined_forecast
'''
Created on 4 Mar 2016
@author: rob
'''
from systems.provided.futures_chapter15.estimatedsystem import PortfoliosEstimated
from systems.provided.futures_chapter15.basesystem import *
from syscore.correlations import get_avg_corr
from copy import copy
import numpy as np
data = csvFuturesData()
all_instruments = data.keys()
config = Config("examples.smallaccountsize.smallaccount.yaml")
all_accounts = []
for instrument_code in all_instruments:
config.instruments = [instrument_code]
system1 = System([
Account(), PortfoliosEstimated(), PositionSizing(), FuturesRawData(),
ForecastCombineFixed(), ForecastScaleCapFixed(), Rules()
], csvFuturesData(), config)
system1.set_logging_level("on")
开发者ID:kohehir,项目名称:pysystemtrade,代码行数:31,代码来源:roundingeffects.py
示例14: System
return combined_forecast
'''
Created on 4 Mar 2016
@author: rob
'''
from systems.provided.futures_chapter15.estimatedsystem import PortfoliosEstimated
from systems.provided.futures_chapter15.basesystem import *
from syscore.correlations import get_avg_corr
from copy import copy
import numpy as np
data=csvFuturesData()
all_instruments=data.keys()
config=Config("examples.smallaccountsize.smallaccount.yaml")
all_accounts=[]
for instrument_code in all_instruments:
config.instruments=[instrument_code]
system1 = System([Account(), PortfoliosEstimated(), PositionSizing(), FuturesRawData(), ForecastCombineFixed(),
ForecastScaleCapFixed(), Rules()], csvFuturesData(), config)
system1.set_logging_level("on")
max_position=float(system1.positionSize.get_volatility_scalar(instrument_code).mean()*2.0)
开发者ID:caitouwh,项目名称:kod,代码行数:31,代码来源:roundingeffects.py
注:本文中的sysdata.csvdata.csvFuturesData函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论