@@ -323,7 +323,7 @@ def test_intraday_volumes_api_key(self, mocker, api_key_client):
323323 'https://api.fugle.tw/marketdata/v1.0/futopt/intraday/volumes/2330' ,
324324 headers = {'X-API-KEY' : 'api-key' }
325325 )
326-
326+
327327class TestFutOptRestHistoricalClient :
328328 def test_futopt_historical (self , api_key_client ):
329329 futopt = api_key_client .futopt
@@ -364,4 +364,104 @@ def test_historical_daily_bearer_token(self, bearer_client, mocker):
364364 mock_get .assert_called_once_with (
365365 'https://api.fugle.tw/marketdata/v1.0/futopt/historical/daily/2330' ,
366366 headers = {'Authorization' : 'Bearer bearer-token' }
367- )
367+ )
368+
369+
370+ class TestStockRestTechnicalClient :
371+ def test_stock_technical (self , api_key_client ):
372+ stock = api_key_client .stock
373+ assert hasattr (stock .technical , 'sma' )
374+ assert hasattr (stock .technical , 'rsi' )
375+ assert hasattr (stock .technical , 'kdj' )
376+ assert hasattr (stock .technical , 'macd' )
377+ assert hasattr (stock .technical , 'bb' )
378+
379+ def test_technical_sma_api_key (self , mocker , api_key_client ):
380+ stock = api_key_client .stock
381+ mock_get = mocker .patch ('requests.get' )
382+ stock .technical .sma (symbol = '2330' )
383+ mock_get .assert_called_once_with (
384+ 'https://api.fugle.tw/marketdata/v1.0/stock/technical/sma/2330' ,
385+ headers = {'X-API-KEY' : 'api-key' }
386+ )
387+
388+ def test_technical_sma_bearer_token (self , mocker , bearer_client ):
389+ stock = bearer_client .stock
390+ mock_get = mocker .patch ('requests.get' )
391+ stock .technical .sma (symbol = '2330' )
392+ mock_get .assert_called_once_with (
393+ 'https://api.fugle.tw/marketdata/v1.0/stock/technical/sma/2330' ,
394+ headers = {'Authorization' : 'Bearer bearer-token' }
395+ )
396+
397+ def test_technical_rsi_api_key (self , mocker , api_key_client ):
398+ stock = api_key_client .stock
399+ mock_get = mocker .patch ('requests.get' )
400+ stock .technical .rsi (symbol = '2330' )
401+ mock_get .assert_called_once_with (
402+ 'https://api.fugle.tw/marketdata/v1.0/stock/technical/rsi/2330' ,
403+ headers = {'X-API-KEY' : 'api-key' }
404+ )
405+
406+ def test_technical_rsi_bearer_token (self , mocker , bearer_client ):
407+ stock = bearer_client .stock
408+ mock_get = mocker .patch ('requests.get' )
409+ stock .technical .rsi (symbol = '2330' )
410+ mock_get .assert_called_once_with (
411+ 'https://api.fugle.tw/marketdata/v1.0/stock/technical/rsi/2330' ,
412+ headers = {'Authorization' : 'Bearer bearer-token' }
413+ )
414+
415+ def test_technical_kdj_api_key (self , mocker , api_key_client ):
416+ stock = api_key_client .stock
417+ mock_get = mocker .patch ('requests.get' )
418+ stock .technical .kdj (symbol = '2330' )
419+ mock_get .assert_called_once_with (
420+ 'https://api.fugle.tw/marketdata/v1.0/stock/technical/kdj/2330' ,
421+ headers = {'X-API-KEY' : 'api-key' }
422+ )
423+
424+ def test_technical_kdj_bearer_token (self , mocker , bearer_client ):
425+ stock = bearer_client .stock
426+ mock_get = mocker .patch ('requests.get' )
427+ stock .technical .kdj (symbol = '2330' )
428+ mock_get .assert_called_once_with (
429+ 'https://api.fugle.tw/marketdata/v1.0/stock/technical/kdj/2330' ,
430+ headers = {'Authorization' : 'Bearer bearer-token' }
431+ )
432+
433+ def test_technical_macd_api_key (self , mocker , api_key_client ):
434+ stock = api_key_client .stock
435+ mock_get = mocker .patch ('requests.get' )
436+ stock .technical .macd (symbol = '2330' )
437+ mock_get .assert_called_once_with (
438+ 'https://api.fugle.tw/marketdata/v1.0/stock/technical/macd/2330' ,
439+ headers = {'X-API-KEY' : 'api-key' }
440+ )
441+
442+ def test_technical_macd_bearer_token (self , mocker , bearer_client ):
443+ stock = bearer_client .stock
444+ mock_get = mocker .patch ('requests.get' )
445+ stock .technical .macd (symbol = '2330' )
446+ mock_get .assert_called_once_with (
447+ 'https://api.fugle.tw/marketdata/v1.0/stock/technical/macd/2330' ,
448+ headers = {'Authorization' : 'Bearer bearer-token' }
449+ )
450+
451+ def test_technical_bb_api_key (self , mocker , api_key_client ):
452+ stock = api_key_client .stock
453+ mock_get = mocker .patch ('requests.get' )
454+ stock .technical .bb (symbol = '2330' )
455+ mock_get .assert_called_once_with (
456+ 'https://api.fugle.tw/marketdata/v1.0/stock/technical/bb/2330' ,
457+ headers = {'X-API-KEY' : 'api-key' }
458+ )
459+
460+ def test_technical_bb_bearer_token (self , mocker , bearer_client ):
461+ stock = bearer_client .stock
462+ mock_get = mocker .patch ('requests.get' )
463+ stock .technical .bb (symbol = '2330' )
464+ mock_get .assert_called_once_with (
465+ 'https://api.fugle.tw/marketdata/v1.0/stock/technical/bb/2330' ,
466+ headers = {'Authorization' : 'Bearer bearer-token' }
467+ )
0 commit comments