Skip to content

Commit 798cf14

Browse files
author
todd
committed
Merge remote-tracking branch 'robcarver17/master' into missing-data-2
2 parents 28cc156 + 90e5469 commit 798cf14

File tree

6 files changed

+104
-8
lines changed

6 files changed

+104
-8
lines changed

data/futures/csvconfig/instrumentconfig.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ KOSPI,Korean equity index KOSPI,250000,KRW,Equity,0.026,0,0.0004,0,ASIA
233233
KOSPI_mini,KOSPI mini,50000,KRW,Equity,0.043,8500,0,0,ASIA
234234
KR10,Korean 10 year bond,1000000,KRW,Bond,0.0065,0,4E-05,0,ASIA
235235
KR3,Korean 3 year bond,1000000,KRW,Bond,0.005,0,4E-05,0,ASIA
236-
KRW,KRWUSD SGX,125000000,USD,FX,0,0,0,0,ASIA
236+
KRW,KRWUSD SGX,125000,USD,FX,0,0,0,0,ASIA
237237
KRWJPY,SGX Korean Won in Japanese Yen Futures,25000000,JPY,FX,0,285,0,0,ASIA
238238
KRWUSD,Korean Won,125000000,USD,FX,1E-06,0.85,0,0,US
239239
KRWUSD_mini,SGX Korean Won in US Dollar Futures (Mini),25000,USD,FX,0.00017,2.85,0,0,ASIA

data/futures/csvconfig/rollconfig.csv

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ COPPER-micro,HUNZ,-30,1,FGHJKMNQUVXZ,15
3939
CORN,Z,-60,-1,HKNUZ,14
4040
CORN_mini,HKNUZ,-30,1,HKNUZ,14
4141
COTTON,HKNVZ,-5,1,HKNVZ,15
42-
COTTON2,HKNVZ,-40,1,HKNVZ,6
42+
COTTON2,HKNZ,-40,1,HKNVZ,6
4343
CRUDE_W,Z,-40,-1,FGHJKMNQUVXZ,-11
4444
CRUDE_W_micro,FGHJKMNQUVXZ,-40,-1,FGHJKMNQUVXZ,-11
4545
CRUDE_W_mini,FGHJKMNQUVXZ,-40,-1,FGHJKMNQUVXZ,-11
@@ -134,6 +134,7 @@ KOSPI,HMUZ,-1,1,HMUZ,13
134134
KOSPI_mini,FGHJKMNQUVXZ,-1,1,FGHJKMNQUVXZ,13
135135
KR10,HMUZ,-1,1,HMUZ,18
136136
KR3,HMUZ,-1,1,HMUZ,18
137+
KRW,FGHJKMNQUVXZ,-10,1,FGHJKMNQUVXZ,12
137138
KRWUSD,FGHJKMNQUVXZ,-10,1,FGHJKMNQUVXZ,15
138139
KRWUSD_mini,FGHJKMNQUVXZ,-10,1,FGHJKMNQUVXZ,15
139140
LEANHOG,GJMNQVZ,-60,-1,GJKMNQVZ,13
@@ -144,6 +145,7 @@ MID-DAX,HMUZ,-5,1,HMUZ,15
144145
MILK,FGHJKMNQUVXZ,-60,-1,FGHJKMNQUVXZ,14
145146
MILKDRY,FGHJKMNQUVXZ,-180,-1,FGHJKMNQUVXZ,18
146147
MILKWET,FGHJKMNQUVXZ,-90,-1,FGHJKMNQUVXZ,15
148+
MILLWHEAT,HKUZ,-60,-1,HKUZ,9
147149
MSCIASIA,HMUZ,-5,1,HMUZ,15
148150
MSCISING,FGHJKMNQUVXZ,-5,1,FGHJKMNQUVXZ,27
149151
MSCIWORLD,HMUZ,-5,1,HMUZ,15
@@ -163,9 +165,11 @@ OMX,HMUZ,-10,1,HMUZ,15
163165
PALLAD,HMUZ,-30,1,HMUZ,26
164166
PLAT,FJNV,-30,1,FJNV,26
165167
PLN,HMUZ,-10,1,HMUZ,15
168+
PLZEUR,HMUZ,-5,1,HMUZ,12
166169
R1000,HMUZ,-10,1,HMUZ,18
167170
R1000_mini,HMUZ,-10,1,HMUZ,18
168171
R1000GROWTH-mini,HMUZ,-10,1,HMUZ,18
172+
RAPESEED,GKQX,-60,-1,GKQX,27
169173
REDWHEAT,HKNUZ,-90,-1,HKNUZ,14
170174
RICE,FHKNUX,-90,-1,FHKNUX,14
171175
ROBUSTA,FHKNUX,-50,1,FHKNUX,24
@@ -229,3 +233,4 @@ WHEAT,Z,-60,-1,HKNUZ,13
229233
WHEAT_mini,HKNUZ,-30,1,HKNUZ,13
230234
WHEY,FGHJKMNQUVXZ,-40,-1,FGHJKMNQUVXZ,15
231235
YENEUR,HMUZ,-5,1,HMUZ,15
236+
ZAR,HMUZ,-5,1,HMUZ,12
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
DATE_TIME,current_contract,next_contract,carry_contract
2+
2001-10-31 23:00:00,20020200,20020500,20011100
3+
2002-01-31 23:00:00,20020500,20020800,20020200
4+
2002-04-30 23:00:00,20020800,20021100,20020500
5+
2002-07-31 23:00:00,20021100,20030200,20020800
6+
2002-10-31 23:00:00,20030200,20030500,20021100
7+
2003-01-31 23:00:00,20030500,20030800,20030200
8+
2003-04-30 23:00:00,20030800,20031100,20030500
9+
2003-07-31 23:00:00,20031100,20040200,20030800
10+
2003-10-31 23:00:00,20040200,20040800,20031100
11+
2004-01-30 23:00:00,20040800,20041100,20040200
12+
2004-07-30 23:00:00,20041100,20050200,20040800
13+
2004-10-29 23:00:00,20050200,20050500,20041100
14+
2005-01-31 23:00:00,20050500,20050800,20050200
15+
2005-04-29 23:00:00,20050800,20051100,20050500
16+
2005-07-29 23:00:00,20051100,20060200,20050800
17+
2005-10-31 23:00:00,20060200,20060500,20051100
18+
2006-01-31 23:00:00,20060500,20060800,20060200
19+
2006-04-28 23:00:00,20060800,20061100,20060500
20+
2006-07-31 23:00:00,20061100,20070200,20060800
21+
2006-10-31 23:00:00,20070200,20070500,20061100
22+
2007-01-31 23:00:00,20070500,20070800,20070200
23+
2007-04-30 23:00:00,20070800,20071100,20070500
24+
2007-07-31 23:00:00,20071100,20080200,20070800
25+
2007-10-31 23:00:00,20080200,20080500,20071100
26+
2008-01-31 23:00:00,20080500,20080800,20080200
27+
2008-04-30 23:00:00,20080800,20081100,20080500
28+
2008-07-31 23:00:00,20081100,20090200,20080800
29+
2008-10-31 23:00:00,20090200,20090500,20081100
30+
2009-01-30 23:00:00,20090500,20090800,20090200
31+
2009-04-30 23:00:00,20090800,20091100,20090500
32+
2009-07-30 23:00:00,20091100,20100200,20090800
33+
2009-10-30 23:00:00,20100200,20100500,20091100
34+
2010-01-29 23:00:00,20100500,20100800,20100200
35+
2010-04-30 23:00:00,20100800,20101100,20100500
36+
2010-07-30 23:00:00,20101100,20110200,20100800
37+
2010-10-29 23:00:00,20110200,20110500,20101100
38+
2011-01-31 23:00:00,20110500,20110800,20110200
39+
2011-07-19 23:00:00,20110800,20111100,20110500
40+
2011-09-29 08:00:00,20111100,20120200,20110800
41+
2011-10-31 09:00:00,20120200,20120500,20111100
42+
2012-02-03 16:00:00,20120500,20120800,20120200
43+
2012-05-01 13:00:00,20120800,20121100,20120500
44+
2012-07-31 09:00:00,20121100,20130200,20120800
45+
2012-10-31 09:00:00,20130200,20130500,20121100
46+
2013-01-31 09:00:00,20130500,20130800,20130200
47+
2013-04-30 08:00:00,20130800,20131100,20130500
48+
2013-07-31 08:00:00,20131100,20140200,20130800
49+
2013-10-31 09:00:00,20140200,20140500,20131100
50+
2014-01-31 09:00:00,20140500,20140800,20140200
51+
2014-04-30 08:00:00,20140800,20141100,20140500
52+
2014-07-31 08:00:00,20141100,20150200,20140800
53+
2014-10-31 09:00:00,20150200,20150500,20141100
54+
2015-01-30 09:00:00,20150500,20150800,20150200
55+
2015-04-30 08:00:00,20150800,20151100,20150500
56+
2015-07-31 08:00:00,20151100,20160200,20150800
57+
2015-10-30 09:00:00,20160200,20160500,20151100
58+
2016-01-29 09:00:00,20160500,20160800,20160200
59+
2016-04-29 08:00:00,20160800,20161100,20160500
60+
2016-07-29 08:00:00,20161100,20170200,20160800
61+
2016-10-31 09:00:00,20170200,20170500,20161100
62+
2017-01-31 09:00:00,20170500,20170800,20170200
63+
2017-04-28 08:00:00,20170800,20171100,20170500
64+
2017-07-31 08:00:00,20171100,20180200,20170800
65+
2017-10-31 09:00:00,20180200,20180500,20171100
66+
2018-01-31 09:00:00,20180500,20180800,20180200
67+
2018-04-30 08:00:00,20180800,20181100,20180500
68+
2018-07-31 08:00:00,20181100,20190200,20180800
69+
2018-10-31 10:00:00,20190200,20190500,20181100
70+
2019-01-31 10:00:00,20190500,20190800,20190200
71+
2019-04-30 08:00:00,20190800,20191100,20190500
72+
2019-07-31 09:00:00,20191100,20200200,20190800
73+
2019-10-31 09:00:00,20200200,20200500,20191100
74+
2020-01-31 09:00:00,20200500,20200800,20200200
75+
2020-04-30 08:00:00,20200800,20201100,20200500
76+
2020-07-31 08:00:00,20201100,20210200,20200800
77+
2020-10-30 10:00:00,20210200,20210500,20201100
78+
2021-01-29 09:00:00,20210500,20210800,20210200
79+
2021-04-30 08:00:00,20210800,20211100,20210500
80+
2021-07-30 09:00:00,20211100,20220200,20210800
81+
2021-10-29 09:00:00,20220200,20220500,20211100
82+
2022-01-31 10:00:00,20220500,20220800,20220200
83+
2022-04-29 08:00:00,20220800,20221100,20220500
84+
2022-07-29 08:00:00,20221100,20230200,20220800
85+
2022-10-31 09:00:00,20230200,20230500,20221100
86+
2023-01-31 09:00:00,20230500,20230800,20230200

sysbrokers/IB/ib_config_futures.csv

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ KOSPI,K200,KSE,NA,250000,1,FALSE
233233
KOSPI_mini,K200M,KSE,KRW,50000,1,FALSE
234234
KR10,FLKTB,KSE,NA,1000000,1,FALSE
235235
KR3,3KTB,KSE,NA,1000000,1,FALSE
236-
KRW,KRW,SGX,USD,125000000,1,FALSE
236+
KRW,KRW,SGX,USD,125000000,1000,FALSE
237237
KRWJPY,KJ,SGX,JPY,25000000,1,FALSE
238238
KRWUSD,KRW,CME,USD,125000000,1,FALSE
239239
KRWUSD_mini,KU,SGX,USD,25000000,1000,FALSE

sysquant/estimators/pooled_correlation.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
from copy import copy
22

33
import syscore.pandas.list_of_df
4-
from syscore.pandas.list_of_df import listOfDataFrames
4+
from syscore.pandas.list_of_df import (
5+
listOfDataFrames,
6+
stacked_df_with_added_time_from_list,
7+
)
58

69
from sysquant.estimators.correlations import CorrelationList
710
from sysquant.estimators.correlation_over_time import correlation_over_time
@@ -25,7 +28,9 @@ def pooled_correlation_estimator(
2528
data_at_common_frequency = downsampled_data.reindex_to_common_index()
2629

2730
# Make into one giant dataframe
28-
pooled_data = syscore.pandas.list_of_df.stacked_df_with_added_time_from_list()
31+
pooled_data = syscore.pandas.list_of_df.stacked_df_with_added_time_from_list(
32+
data_at_common_frequency
33+
)
2934

3035
correlation_list = correlation_over_time(
3136
pooled_data, **kwargs, length_adjustment=length_adjustment

sysquant/returns.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import pandas as pd
22
import numpy as np
33

4-
import syscore.pandas.list_of_df
54
from systems.accounts.curves.account_curve_group import accountCurveGroup
65
from syscore.genutils import flatten_list
76
from syscore.dateutils import ROOT_BDAYS_INYEAR
87

98
from syscore.pandas.list_of_df import listOfDataFrames
9+
from syscore.pandas.list_of_df import stacked_df_with_added_time_from_list
1010

1111
SINGLE_NAME = "asset"
1212

@@ -129,8 +129,8 @@ def single_resampled_set_of_returns(self, frequency: str) -> returnsForOptimisat
129129
returns_as_list_downsampled.reindex_to_common_index()
130130
)
131131

132-
returns_for_optimisation = (
133-
syscore.pandas.list_of_df.stacked_df_with_added_time_from_list()
132+
returns_for_optimisation = stacked_df_with_added_time_from_list(
133+
returns_as_list_common_ts
134134
)
135135
returns_for_optimisation = returnsForOptimisation(
136136
returns_for_optimisation, frequency=frequency, pooled_length=pooled_length

0 commit comments

Comments
 (0)