5
5
import datetime
6
6
import logging
7
7
import time
8
- from typing import Any , Awaitable , Dict , Iterator , List , Optional , Union
8
+ from typing import Any , Awaitable , Iterator , List , Optional , Sequence , Union
9
9
10
10
from eventkit import Event
11
11
from enum import Flag , auto
@@ -1114,7 +1114,7 @@ def reqRealTimeBars(
1114
1114
barSize : int ,
1115
1115
whatToShow : str ,
1116
1116
useRTH : bool ,
1117
- realTimeBarsOptions : List [TagValue ] = [] ,
1117
+ realTimeBarsOptions : Sequence [TagValue ] = () ,
1118
1118
) -> RealTimeBarList :
1119
1119
"""
1120
1120
Request realtime 5 second bars.
@@ -1137,7 +1137,7 @@ def reqRealTimeBars(
1137
1137
bars .barSize = barSize
1138
1138
bars .whatToShow = whatToShow
1139
1139
bars .useRTH = useRTH
1140
- bars .realTimeBarsOptions = realTimeBarsOptions or []
1140
+ bars .realTimeBarsOptions = list ( realTimeBarsOptions or [])
1141
1141
self .wrapper .startSubscription (reqId , bars , contract )
1142
1142
self .client .reqRealTimeBars (
1143
1143
reqId , contract , barSize , whatToShow , useRTH , realTimeBarsOptions
@@ -1164,7 +1164,7 @@ def reqHistoricalData(
1164
1164
useRTH : bool ,
1165
1165
formatDate : int = 1 ,
1166
1166
keepUpToDate : bool = False ,
1167
- chartOptions : List [TagValue ] = [] ,
1167
+ chartOptions : Sequence [TagValue ] = () ,
1168
1168
timeout : float = 60 ,
1169
1169
) -> BarDataList :
1170
1170
"""
@@ -1271,7 +1271,7 @@ def reqHistoricalTicks(
1271
1271
whatToShow : str ,
1272
1272
useRth : bool ,
1273
1273
ignoreSize : bool = False ,
1274
- miscOptions : List [TagValue ] = [] ,
1274
+ miscOptions : Sequence [TagValue ] = () ,
1275
1275
) -> List :
1276
1276
"""
1277
1277
Request historical ticks. The time resolution of the ticks
@@ -1351,7 +1351,7 @@ def reqMktData(
1351
1351
genericTickList : str = "" ,
1352
1352
snapshot : bool = False ,
1353
1353
regulatorySnapshot : bool = False ,
1354
- mktDataOptions : List [TagValue ] = [] ,
1354
+ mktDataOptions : Sequence [TagValue ] = () ,
1355
1355
) -> Ticker :
1356
1356
"""
1357
1357
Subscribe to tick data or request a snapshot.
@@ -1568,7 +1568,7 @@ def reqFundamentalData(
1568
1568
self ,
1569
1569
contract : Contract ,
1570
1570
reportType : str ,
1571
- fundamentalDataOptions : List [TagValue ] = [] ,
1571
+ fundamentalDataOptions : Sequence [TagValue ] = () ,
1572
1572
) -> str :
1573
1573
"""
1574
1574
Get fundamental data of a contract in XML format.
@@ -1596,8 +1596,8 @@ def reqFundamentalData(
1596
1596
def reqScannerData (
1597
1597
self ,
1598
1598
subscription : ScannerSubscription ,
1599
- scannerSubscriptionOptions : List [TagValue ] = [] ,
1600
- scannerSubscriptionFilterOptions : List [TagValue ] = [] ,
1599
+ scannerSubscriptionOptions : Sequence [TagValue ] = () ,
1600
+ scannerSubscriptionFilterOptions : Sequence [TagValue ] = () ,
1601
1601
) -> ScanDataList :
1602
1602
"""
1603
1603
Do a blocking market scan by starting a subscription and canceling it
@@ -1623,8 +1623,8 @@ def reqScannerData(
1623
1623
def reqScannerSubscription (
1624
1624
self ,
1625
1625
subscription : ScannerSubscription ,
1626
- scannerSubscriptionOptions : List [TagValue ] = [] ,
1627
- scannerSubscriptionFilterOptions : List [TagValue ] = [] ,
1626
+ scannerSubscriptionOptions : Sequence [TagValue ] = () ,
1627
+ scannerSubscriptionFilterOptions : Sequence [TagValue ] = () ,
1628
1628
) -> ScanDataList :
1629
1629
"""
1630
1630
Subscribe to market scan data.
@@ -1640,8 +1640,8 @@ def reqScannerSubscription(
1640
1640
dataList = ScanDataList ()
1641
1641
dataList .reqId = reqId
1642
1642
dataList .subscription = subscription
1643
- dataList .scannerSubscriptionOptions = scannerSubscriptionOptions or []
1644
- dataList .scannerSubscriptionFilterOptions = (
1643
+ dataList .scannerSubscriptionOptions = list ( scannerSubscriptionOptions or [])
1644
+ dataList .scannerSubscriptionFilterOptions = list (
1645
1645
scannerSubscriptionFilterOptions or []
1646
1646
)
1647
1647
self .wrapper .startSubscription (reqId , dataList )
@@ -1679,7 +1679,7 @@ def calculateImpliedVolatility(
1679
1679
contract : Contract ,
1680
1680
optionPrice : float ,
1681
1681
underPrice : float ,
1682
- implVolOptions : List [TagValue ] = [] ,
1682
+ implVolOptions : Sequence [TagValue ] = () ,
1683
1683
) -> OptionComputation :
1684
1684
"""
1685
1685
Calculate the volatility given the option price.
@@ -1705,7 +1705,7 @@ def calculateOptionPrice(
1705
1705
contract : Contract ,
1706
1706
volatility : float ,
1707
1707
underPrice : float ,
1708
- optPrcOptions : List [TagValue ] = [] ,
1708
+ optPrcOptions : Sequence [TagValue ] = () ,
1709
1709
) -> OptionComputation :
1710
1710
"""
1711
1711
Calculate the option price given the volatility.
@@ -1718,7 +1718,7 @@ def calculateOptionPrice(
1718
1718
contract: Option contract.
1719
1719
volatility: Option volatility to use in calculation.
1720
1720
underPrice: Price of the underlier to use in calculation
1721
- implVolOptions: Unknown
1721
+ optPrcOptions: TODO
1722
1722
"""
1723
1723
return self ._run (
1724
1724
self .calculateOptionPriceAsync (
@@ -1792,7 +1792,7 @@ def reqNewsProviders(self) -> List[NewsProvider]:
1792
1792
return self ._run (self .reqNewsProvidersAsync ())
1793
1793
1794
1794
def reqNewsArticle (
1795
- self , providerCode : str , articleId : str , newsArticleOptions : List [TagValue ] = []
1795
+ self , providerCode : str , articleId : str , newsArticleOptions : Sequence [TagValue ] = ()
1796
1796
) -> NewsArticle :
1797
1797
"""
1798
1798
Get the body of a news article.
@@ -1817,7 +1817,7 @@ def reqHistoricalNews(
1817
1817
startDateTime : Union [str , datetime .date ],
1818
1818
endDateTime : Union [str , datetime .date ],
1819
1819
totalResults : int ,
1820
- historicalNewsOptions : List [TagValue ] = [] ,
1820
+ historicalNewsOptions : Sequence [TagValue ] = () ,
1821
1821
) -> HistoricalNews :
1822
1822
"""
1823
1823
Get historical news headline.
@@ -2261,7 +2261,7 @@ async def reqHistoricalDataAsync(
2261
2261
useRTH : bool ,
2262
2262
formatDate : int = 1 ,
2263
2263
keepUpToDate : bool = False ,
2264
- chartOptions : List [TagValue ] = [] ,
2264
+ chartOptions : Sequence [TagValue ] = () ,
2265
2265
timeout : float = 60 ,
2266
2266
) -> BarDataList :
2267
2267
reqId = self .client .getReqId ()
@@ -2275,7 +2275,7 @@ async def reqHistoricalDataAsync(
2275
2275
bars .useRTH = useRTH
2276
2276
bars .formatDate = formatDate
2277
2277
bars .keepUpToDate = keepUpToDate
2278
- bars .chartOptions = chartOptions or []
2278
+ bars .chartOptions = list ( chartOptions or [])
2279
2279
future = self .wrapper .startReq (reqId , contract , container = bars )
2280
2280
if keepUpToDate :
2281
2281
self .wrapper .startSubscription (reqId , bars , contract )
@@ -2336,7 +2336,7 @@ def reqHistoricalTicksAsync(
2336
2336
whatToShow : str ,
2337
2337
useRth : bool ,
2338
2338
ignoreSize : bool = False ,
2339
- miscOptions : List [TagValue ] = [] ,
2339
+ miscOptions : Sequence [TagValue ] = () ,
2340
2340
) -> Awaitable [List ]:
2341
2341
reqId = self .client .getReqId ()
2342
2342
future = self .wrapper .startReq (reqId , contract )
@@ -2392,7 +2392,7 @@ def reqFundamentalDataAsync(
2392
2392
self ,
2393
2393
contract : Contract ,
2394
2394
reportType : str ,
2395
- fundamentalDataOptions : List [TagValue ] = [] ,
2395
+ fundamentalDataOptions : Sequence [TagValue ] = () ,
2396
2396
) -> Awaitable [str ]:
2397
2397
reqId = self .client .getReqId ()
2398
2398
@@ -2405,13 +2405,13 @@ def reqFundamentalDataAsync(
2405
2405
async def reqScannerDataAsync (
2406
2406
self ,
2407
2407
subscription : ScannerSubscription ,
2408
- scannerSubscriptionOptions : List [TagValue ] = [] ,
2409
- scannerSubscriptionFilterOptions : List [TagValue ] = [] ,
2408
+ scannerSubscriptionOptions : Sequence [TagValue ] = () ,
2409
+ scannerSubscriptionFilterOptions : Sequence [TagValue ] = () ,
2410
2410
) -> ScanDataList :
2411
2411
dataList = self .reqScannerSubscription (
2412
2412
subscription ,
2413
- scannerSubscriptionOptions or [],
2414
- scannerSubscriptionFilterOptions or [],
2413
+ list ( scannerSubscriptionOptions or []) ,
2414
+ list ( scannerSubscriptionFilterOptions or []) ,
2415
2415
)
2416
2416
2417
2417
future = self .wrapper .startReq (dataList .reqId , container = dataList )
@@ -2430,7 +2430,7 @@ async def calculateImpliedVolatilityAsync(
2430
2430
contract : Contract ,
2431
2431
optionPrice : float ,
2432
2432
underPrice : float ,
2433
- implVolOptions : List [TagValue ] = [] ,
2433
+ implVolOptions : Sequence [TagValue ] = () ,
2434
2434
) -> Optional [OptionComputation ]:
2435
2435
reqId = self .client .getReqId ()
2436
2436
future = self .wrapper .startReq (reqId , contract )
@@ -2451,7 +2451,7 @@ async def calculateOptionPriceAsync(
2451
2451
contract : Contract ,
2452
2452
volatility : float ,
2453
2453
underPrice : float ,
2454
- optPrcOptions : List [TagValue ] = [] ,
2454
+ optPrcOptions : Sequence [TagValue ] = () ,
2455
2455
) -> Optional [OptionComputation ]:
2456
2456
reqId = self .client .getReqId ()
2457
2457
future = self .wrapper .startReq (reqId , contract )
@@ -2488,7 +2488,7 @@ def reqNewsProvidersAsync(self) -> Awaitable[List[NewsProvider]]:
2488
2488
return future
2489
2489
2490
2490
def reqNewsArticleAsync (
2491
- self , providerCode : str , articleId : str , newsArticleOptions : List [TagValue ] = []
2491
+ self , providerCode : str , articleId : str , newsArticleOptions : Sequence [TagValue ] = ()
2492
2492
) -> Awaitable [NewsArticle ]:
2493
2493
reqId = self .client .getReqId ()
2494
2494
@@ -2503,7 +2503,7 @@ async def reqHistoricalNewsAsync(
2503
2503
startDateTime : Union [str , datetime .date ],
2504
2504
endDateTime : Union [str , datetime .date ],
2505
2505
totalResults : int ,
2506
- historicalNewsOptions : List [TagValue ] = [] ,
2506
+ historicalNewsOptions : Sequence [TagValue ] = () ,
2507
2507
) -> Optional [HistoricalNews ]:
2508
2508
reqId = self .client .getReqId ()
2509
2509
0 commit comments