@@ -457,9 +457,8 @@ def test_live_sets_dependent_configurations_from_modules_json_based_on_environme
457457}
458458
459459data_provider_required_options = {
460- "IEX" : {
461- "iex-cloud-api-key" : "123" ,
462- "iex-price-plan" : "Launch" ,
460+ "ThetaData" : {
461+ "thetadata-subscription-plan" : "Pro" ,
463462 },
464463 "Polygon" : {
465464 "polygon-api-key" : "123" ,
@@ -1130,9 +1129,7 @@ def test_live_non_interactive_deploy_with_live_and_historical_provider_missed_hi
11301129
11311130 container .initialize (docker_manager = mock .Mock (), lean_runner = mock .Mock (), api_client = mock .MagicMock ())
11321131
1133- provider_live_option = ["--data-provider-live" , "IEX" ,
1134- "--iex-cloud-api-key" , "123" ,
1135- "--iex-price-plan" , "Launch" ]
1132+ provider_live_option = ["--data-provider-live" , "Polygon" ]
11361133
11371134 provider_history_option = ["--data-provider-historical" , "Polygon" ]
11381135 # "--polygon-api-key", "123"]
@@ -1145,7 +1142,6 @@ def test_live_non_interactive_deploy_with_live_and_historical_provider_missed_hi
11451142 error_msg = str (result .exc_info [1 ]).split ()
11461143
11471144 assert "--polygon-api-key" in error_msg
1148- assert "--iex-cloud-api-key" not in error_msg
11491145
11501146 assert result .exit_code == 1
11511147
@@ -1155,11 +1151,9 @@ def test_live_non_interactive_deploy_with_live_and_historical_provider_missed_li
11551151
11561152 container .initialize (docker_manager = mock .Mock (), lean_runner = mock .Mock (), api_client = mock .MagicMock ())
11571153
1158- provider_live_option = ["--data-provider-live" , "IEX" ,
1159- "--iex-cloud-api-key" , "123" ]
1160- #"--iex-price-plan", "Launch"]
1154+ provider_live_option = ["--data-provider-live" , "Polygon" , "--polygon-api-key" , "123" ]
11611155
1162- provider_history_option = ["--data-provider-historical" , "Polygon" , "--polygon-api-key" , "123" ]
1156+ provider_history_option = ["--data-provider-historical" , "Polygon" ]
11631157
11641158 result = CliRunner ().invoke (lean , ["live" , "deploy" , "--brokerage" , "Paper Trading" ,
11651159 * provider_live_option ,
@@ -1169,10 +1163,9 @@ def test_live_non_interactive_deploy_with_live_and_historical_provider_missed_li
11691163
11701164 error_msg = str (result .exc_info [1 ]).split ()
11711165
1172- assert "--iex-price-plan" in error_msg
11731166 assert "--polygon-api-key" not in error_msg
11741167
1175- assert result .exit_code == 1
1168+ assert result .exit_code == 0
11761169
11771170def test_live_non_interactive_deploy_with_real_brokerage_without_credentials () -> None :
11781171 create_fake_lean_cli_directory ()
@@ -1183,9 +1176,7 @@ def test_live_non_interactive_deploy_with_real_brokerage_without_credentials() -
11831176 # create fake environment has IB configs already
11841177 brokerage = ["--brokerage" , "OANDA" ]
11851178
1186- provider_live_option = ["--data-provider-live" , "IEX" ,
1187- "--iex-cloud-api-key" , "123" ,
1188- "--iex-price-plan" , "Launch" ]
1179+ provider_live_option = ["--data-provider-live" , "Polygon" , "--polygon-api-key" , "123" ]
11891180
11901181 result = CliRunner ().invoke (lean , ["live" , "deploy" ,
11911182 * brokerage ,
@@ -1199,7 +1190,6 @@ def test_live_non_interactive_deploy_with_real_brokerage_without_credentials() -
11991190 assert "--oanda-account-id" in error_msg
12001191 assert "--oanda-access-token" in error_msg
12011192 assert "--oanda-environment" in error_msg
1202- assert "--iex-price-plan" not in error_msg
12031193
12041194
12051195def create_lean_option (brokerage_name : str , data_provider_live_name : str , data_provider_historical_name : str ,
@@ -1239,10 +1229,10 @@ def create_lean_option(brokerage_name: str, data_provider_live_name: str, data_p
12391229 return result
12401230
12411231@pytest .mark .parametrize ("brokerage_name,data_provider_live_name,data_provider_historical_name,brokerage_product_id,data_provider_live_product_id,data_provider_historical_id" ,
1242- [("Interactive Brokers" , "IEX " , "Polygon" , "181" , "333 " , "306" ),
1243- ("Paper Trading" , "IEX " , "Polygon" , None , "333 " , "306" ),
1244- ("Tradier" , "IEX " , "AlphaVantage" , "185" , "333 " , "334" ),
1245- ("Paper Trading" , "IEX " , "Local" , None , "333 " , "222" )])
1232+ [("Interactive Brokers" , "ThetaData " , "Polygon" , "181" , "344 " , "306" ),
1233+ ("Paper Trading" , "ThetaData " , "Polygon" , None , "344 " , "306" ),
1234+ ("Tradier" , "ThetaData " , "AlphaVantage" , "185" , "344 " , "334" ),
1235+ ("Paper Trading" , "ThetaData " , "Local" , None , "344 " , "222" )])
12461236def test_live_deploy_with_different_brokerage_and_different_live_data_provider_and_historical_data_provider (brokerage_name : str , data_provider_live_name : str , data_provider_historical_name : str , brokerage_product_id : str , data_provider_live_product_id : str , data_provider_historical_id : str ) -> None :
12471237 if (brokerage_name == "Interactive Brokers" and sys .platform == "darwin" ):
12481238 pytest .skip ("MacOS does not support IB tests" )
@@ -1257,10 +1247,10 @@ def test_live_deploy_with_different_brokerage_and_different_live_data_provider_a
12571247 if id in m_c [1 ]:
12581248 is_exists .append (True )
12591249 assert is_exists
1260- assert len (is_exists ) == 2
1250+ assert len (is_exists ) == 1
12611251 elif brokerage_product_id is None and data_provider_historical_name == "Local" :
12621252 assert len (api_client .method_calls ) == 1
1263- if data_provider_live_product_id in api_client .method_calls [0 ][1 ]:
1253+ if int ( data_provider_live_product_id ) in api_client .method_calls [0 ][1 ]:
12641254 is_exists .append (True )
12651255 assert is_exists
12661256 assert len (is_exists ) == 1
@@ -1273,8 +1263,8 @@ def test_live_deploy_with_different_brokerage_and_different_live_data_provider_a
12731263 assert len (is_exists ) == 3
12741264
12751265@pytest .mark .parametrize ("brokerage_name,data_provider_live_name,brokerage_product_id,data_provider_live_product_id" ,
1276- [("Interactive Brokers" , "IEX " , "181" , "333 " ),
1277- ("Tradier" , "IEX " , "185" , "333 " )])
1266+ [("Interactive Brokers" , "Polygon " , "181" , "306 " ),
1267+ ("Tradier" , "Polygon " , "185" , "306 " )])
12781268def test_live_non_interactive_deploy_with_different_brokerage_and_different_live_data_provider (brokerage_name : str , data_provider_live_name : str , brokerage_product_id : str , data_provider_live_product_id : str ) -> None :
12791269 if (brokerage_name == "Interactive Brokers" and sys .platform == "darwin" ):
12801270 pytest .skip ("MacOS does not support IB tests" )
@@ -1313,15 +1303,15 @@ def test_live_non_interactive_deploy_with_different_brokerage_with_the_same_live
13131303 assert is_exist
13141304
13151305@pytest .mark .parametrize ("brokerage_name,data_provider_live_name,data_provider_live_product_id" ,
1316- [("Paper Trading" , "IEX " , "333 " ),
1306+ [("Paper Trading" , "ThetaData " , "344 " ),
13171307 ("Paper Trading" , "Polygon" , "306" )])
13181308def test_live_non_interactive_deploy_paper_brokerage_different_live_data_provider (brokerage_name : str , data_provider_live_name : str , data_provider_live_product_id : str ) -> None :
13191309 api_client = mock .MagicMock ()
13201310 create_lean_option (brokerage_name , data_provider_live_name , None , api_client )
13211311
13221312 assert len (api_client .method_calls ) == 1
13231313 for m_c in api_client .method_calls :
1324- if data_provider_live_product_id in m_c [1 ]:
1314+ if data_provider_live_product_id in str ( m_c [1 ]) :
13251315 is_exist = True
13261316
13271317 assert is_exist
0 commit comments