/
techindicators.py
1077 lines (961 loc) · 53.3 KB
/
techindicators.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
from .alphavantage import AlphaVantage as av
class TechIndicators(av):
"""This class implements all the technical indicator api calls
"""
def __init__(self, *args, **kwargs):
"""
Inherit AlphaVantage base class with its default arguments
"""
super(TechIndicators, self).__init__(*args, **kwargs)
self._append_type = False
if self.output_format.lower() == 'csv':
raise ValueError("Output format {} is not comatible with the TechIndicators class".format(
self.output_format.lower()))
@av._output_format
@av._call_api_on_func
def get_sma(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return simple moving average time series in two json objects as data and
meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "SMA"
return _FUNCTION_KEY, 'Technical Analysis: SMA', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_ema(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return exponential moving average time series in two json objects
as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "EMA"
return _FUNCTION_KEY, 'Technical Analysis: EMA', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_wma(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return weighted moving average time series in two json objects
as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "WMA"
return _FUNCTION_KEY, 'Technical Analysis: WMA', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_dema(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return double exponential moving average time series in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "DEMA"
return _FUNCTION_KEY, 'Technical Analysis: DEMA', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_tema(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return triple exponential moving average time series in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "TEMA"
return _FUNCTION_KEY, 'Technical Analysis: TEMA', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_trima(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return triangular moving average time series in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "TRIMA"
return _FUNCTION_KEY, 'Technical Analysis: TRIMA', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_kama(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return Kaufman adaptative moving average time series in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "KAMA"
return _FUNCTION_KEY, 'Technical Analysis: KAMA', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_mama(self, symbol, interval='daily', series_type='close',
fastlimit=None, slowlimit=None):
""" Return MESA adaptative moving average time series in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
fastlimit: Positive floats for the fast limit are accepted
(default=None)
slowlimit: Positive floats for the slow limit are accepted
(default=None)
"""
_FUNCTION_KEY = "MAMA"
return _FUNCTION_KEY, 'Technical Analysis: MAMA', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_vwap(self, symbol, interval='5min'):
""" Returns the volume weighted average price (VWAP) for intraday time series.
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min'
(default 5min)
"""
_FUNCTION_KEY = "VWAP"
return _FUNCTION_KEY, 'Technical Analysis: VWAP', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_t3(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return triple exponential moving average time series in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "T3"
return _FUNCTION_KEY, 'Technical Analysis: T3', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_macd(self, symbol, interval='daily', series_type='close',
fastperiod=None, slowperiod=None, signalperiod=None):
""" Return the moving average convergence/divergence time series in two
json objects as data and meta_data. It raises ValueError when problems
arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily'
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
fastperiod: Positive integers are accepted (default=None)
slowperiod: Positive integers are accepted (default=None)
signalperiod: Positive integers are accepted (default=None)
"""
_FUNCTION_KEY = "MACD"
return _FUNCTION_KEY, 'Technical Analysis: MACD', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_macdext(self, symbol, interval='daily', series_type='close',
fastperiod=None, slowperiod=None, signalperiod=None, fastmatype=None,
slowmatype=None, signalmatype=None):
""" Return the moving average convergence/divergence time series in two
json objects as data and meta_data. It raises ValueError when problems
arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
fastperiod: Positive integers are accepted (default=None)
slowperiod: Positive integers are accepted (default=None)
signalperiod: Positive integers are accepted (default=None)
fastmatype: Moving average type for the faster moving average.
By default, fastmatype=0. Integers 0 - 8 are accepted
(check down the mappings) or the string containing the math type can
also be used.
slowmatype: Moving average type for the slower moving average.
By default, slowmatype=0. Integers 0 - 8 are accepted
(check down the mappings) or the string containing the math type can
also be used.
signalmatype: Moving average type for the signal moving average.
By default, signalmatype=0. Integers 0 - 8 are accepted
(check down the mappings) or the string containing the math type can
also be used.
* 0 = Simple Moving Average (SMA),
* 1 = Exponential Moving Average (EMA),
* 2 = Weighted Moving Average (WMA),
* 3 = Double Exponential Moving Average (DEMA),
* 4 = Triple Exponential Moving Average (TEMA),
* 5 = Triangular Moving Average (TRIMA),
* 6 = T3 Moving Average,
* 7 = Kaufman Adaptive Moving Average (KAMA),
* 8 = MESA Adaptive Moving Average (MAMA)
"""
_FUNCTION_KEY = "MACDEXT"
return _FUNCTION_KEY, 'Technical Analysis: MACDEXT', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_stoch(self, symbol, interval='daily', fastkperiod=None,
slowkperiod=None, slowdperiod=None, slowkmatype=None, slowdmatype=None):
""" Return the stochatic oscillator values in two
json objects as data and meta_data. It raises ValueError when problems
arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
fastkperiod: The time period of the fastk moving average. Positive
integers are accepted (default=None)
slowkperiod: The time period of the slowk moving average. Positive
integers are accepted (default=None)
slowdperiod: The time period of the slowd moving average. Positive
integers are accepted (default=None)
slowkmatype: Moving average type for the slowk moving average.
By default, fastmatype=0. Integers 0 - 8 are accepted
(check down the mappings) or the string containing the math type can
also be used.
slowdmatype: Moving average type for the slowd moving average.
By default, slowmatype=0. Integers 0 - 8 are accepted
(check down the mappings) or the string containing the math type can
also be used.
* 0 = Simple Moving Average (SMA),
* 1 = Exponential Moving Average (EMA),
* 2 = Weighted Moving Average (WMA),
* 3 = Double Exponential Moving Average (DEMA),
* 4 = Triple Exponential Moving Average (TEMA),
* 5 = Triangular Moving Average (TRIMA),
* 6 = T3 Moving Average,
* 7 = Kaufman Adaptive Moving Average (KAMA),
* 8 = MESA Adaptive Moving Average (MAMA)
"""
_FUNCTION_KEY = "STOCH"
return _FUNCTION_KEY, 'Technical Analysis: STOCH', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_stochf(self, symbol, interval='daily', fastkperiod=None,
fastdperiod=None, fastdmatype=None):
""" Return the stochatic oscillator values in two
json objects as data and meta_data. It raises ValueError when problems
arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
fastkperiod: The time period of the fastk moving average. Positive
integers are accepted (default=None)
fastdperiod: The time period of the fastd moving average. Positive
integers are accepted (default=None)
fastdmatype: Moving average type for the fastdmatype moving average.
By default, fastmatype=0. Integers 0 - 8 are accepted
(check down the mappings) or the string containing the math type can
also be used.
* 0 = Simple Moving Average (SMA),
* 1 = Exponential Moving Average (EMA),
* 2 = Weighted Moving Average (WMA),
* 3 = Double Exponential Moving Average (DEMA),
* 4 = Triple Exponential Moving Average (TEMA),
* 5 = Triangular Moving Average (TRIMA),
* 6 = T3 Moving Average,
* 7 = Kaufman Adaptive Moving Average (KAMA),
* 8 = MESA Adaptive Moving Average (MAMA)
"""
_FUNCTION_KEY = "STOCHF"
return _FUNCTION_KEY, 'Technical Analysis: STOCHF', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_rsi(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return the relative strength index time series in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "RSI"
return _FUNCTION_KEY, 'Technical Analysis: RSI', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_stochrsi(self, symbol, interval='daily', time_period=20,
series_type='close', fastkperiod=None, fastdperiod=None, fastdmatype=None):
""" Return the stochatic relative strength index in two
json objects as data and meta_data. It raises ValueError when problems
arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
fastkperiod: The time period of the fastk moving average. Positive
integers are accepted (default=None)
fastdperiod: The time period of the fastd moving average. Positive
integers are accepted (default=None)
fastdmatype: Moving average type for the fastdmatype moving average.
By default, fastmatype=0. Integers 0 - 8 are accepted
(check down the mappings) or the string containing the math type can
also be used.
* 0 = Simple Moving Average (SMA),
* 1 = Exponential Moving Average (EMA),
* 2 = Weighted Moving Average (WMA),
* 3 = Double Exponential Moving Average (DEMA),
* 4 = Triple Exponential Moving Average (TEMA),
* 5 = Triangular Moving Average (TRIMA),
* 6 = T3 Moving Average,
* 7 = Kaufman Adaptive Moving Average (KAMA),
* 8 = MESA Adaptive Moving Average (MAMA)
"""
_FUNCTION_KEY = "STOCHRSI"
return _FUNCTION_KEY, 'Technical Analysis: STOCHRSI', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_willr(self, symbol, interval='daily', time_period=20):
""" Return the Williams' %R (WILLR) values in two json objects as data
and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
"""
_FUNCTION_KEY = "WILLR"
return _FUNCTION_KEY, 'Technical Analysis: WILLR', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_adx(self, symbol, interval='daily', time_period=20):
""" Return the average directional movement index values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
"""
_FUNCTION_KEY = "ADX"
return _FUNCTION_KEY, 'Technical Analysis: ADX', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_adxr(self, symbol, interval='daily', time_period=20):
""" Return the average directional movement index rating in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
"""
_FUNCTION_KEY = "ADXR"
return _FUNCTION_KEY, 'Technical Analysis: ADXR', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_apo(self, symbol, interval='daily', series_type='close',
fastperiod=None, slowperiod=None, matype=None):
""" Return the absolute price oscillator values in two
json objects as data and meta_data. It raises ValueError when problems
arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default '60min)'
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
fastperiod: Positive integers are accepted (default=None)
slowperiod: Positive integers are accepted (default=None)
matype : Moving average type. By default, fastmatype=0.
Integers 0 - 8 are accepted (check down the mappings) or the string
containing the math type can also be used.
* 0 = Simple Moving Average (SMA),
* 1 = Exponential Moving Average (EMA),
* 2 = Weighted Moving Average (WMA),
* 3 = Double Exponential Moving Average (DEMA),
* 4 = Triple Exponential Moving Average (TEMA),
* 5 = Triangular Moving Average (TRIMA),
* 6 = T3 Moving Average,
* 7 = Kaufman Adaptive Moving Average (KAMA),
* 8 = MESA Adaptive Moving Average (MAMA)
"""
_FUNCTION_KEY = "APO"
return _FUNCTION_KEY, 'Technical Analysis: APO', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_ppo(self, symbol, interval='daily', series_type='close',
fastperiod=None, slowperiod=None, matype=None):
""" Return the percentage price oscillator values in two
json objects as data and meta_data. It raises ValueError when problems
arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily'
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
fastperiod: Positive integers are accepted (default=None)
slowperiod: Positive integers are accepted (default=None)
matype : Moving average type. By default, fastmatype=0.
Integers 0 - 8 are accepted (check down the mappings) or the string
containing the math type can also be used.
* 0 = Simple Moving Average (SMA),
* 1 = Exponential Moving Average (EMA),
* 2 = Weighted Moving Average (WMA),
* 3 = Double Exponential Moving Average (DEMA),
* 4 = Triple Exponential Moving Average (TEMA),
* 5 = Triangular Moving Average (TRIMA),
* 6 = T3 Moving Average,
* 7 = Kaufman Adaptive Moving Average (KAMA),
* 8 = MESA Adaptive Moving Average (MAMA)
"""
_FUNCTION_KEY = "PPO"
return _FUNCTION_KEY, 'Technical Analysis: PPO', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_mom(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return the momentum values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "MOM"
return _FUNCTION_KEY, 'Technical Analysis: MOM', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_bop(self, symbol, interval='daily', time_period=20):
""" Return the balance of power values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
"""
_FUNCTION_KEY = "BOP"
return _FUNCTION_KEY, 'Technical Analysis: BOP', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_cci(self, symbol, interval='daily', time_period=20):
""" Return the commodity channel index values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
"""
_FUNCTION_KEY = "CCI"
return _FUNCTION_KEY, 'Technical Analysis: CCI', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_cmo(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return the Chande momentum oscillator in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "CMO"
return _FUNCTION_KEY, 'Technical Analysis: CMO', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_roc(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return the rate of change values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "ROC"
return _FUNCTION_KEY, 'Technical Analysis: ROC', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_rocr(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return the rate of change ratio values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "ROCR"
return _FUNCTION_KEY, 'Technical Analysis: ROCR', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_aroon(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return the aroon values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "AROON"
return _FUNCTION_KEY, 'Technical Analysis: AROON', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_aroonosc(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return the aroon oscillator values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "AROONOSC"
return _FUNCTION_KEY, 'Technical Analysis: AROONOSC', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_mfi(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return the money flow index values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "MFI"
return _FUNCTION_KEY, 'Technical Analysis: MFI', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_trix(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return the1-day rate of change of a triple smooth exponential
moving average in two json objects as data and meta_data.
It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "TRIX"
return _FUNCTION_KEY, 'Technical Analysis: TRIX', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_ultosc(self, symbol, interval='daily', timeperiod1=None,
timeperiod2=None, timeperiod3=None):
""" Return the ultimate oscillaror values in two json objects as
data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
timeperiod1: The first time period indicator. Positive integers are
accepted. By default, timeperiod1=7
timeperiod2: The first time period indicator. Positive integers are
accepted. By default, timeperiod2=14
timeperiod3: The first time period indicator. Positive integers are
accepted. By default, timeperiod3=28
"""
_FUNCTION_KEY = "ULTOSC"
return _FUNCTION_KEY, 'Technical Analysis: ULTOSC', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_dx(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return the directional movement index values in two json objects as
data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "DX"
return _FUNCTION_KEY, 'Technical Analysis: DX', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_minus_di(self, symbol, interval='daily', time_period=20):
""" Return the minus directional indicator values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
"""
_FUNCTION_KEY = "MINUS_DI"
return _FUNCTION_KEY, 'Technical Analysis: MINUS_DI', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_plus_di(self, symbol, interval='daily', time_period=20):
""" Return the plus directional indicator values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
"""
_FUNCTION_KEY = "PLUS_DI"
return _FUNCTION_KEY, 'Technical Analysis: PLUS_DI', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_minus_dm(self, symbol, interval='daily', time_period=20):
""" Return the minus directional movement values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
"""
_FUNCTION_KEY = "MINUS_DM"
return _FUNCTION_KEY, 'Technical Analysis: MINUS_DM', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_plus_dm(self, symbol, interval='daily', time_period=20):
""" Return the plus directional movement values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
"""
_FUNCTION_KEY = "PLUS_DM"
return _FUNCTION_KEY, 'Technical Analysis: PLUS_DM', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_bbands(self, symbol, interval='daily', time_period=20, series_type='close',
nbdevup=None, nbdevdn=None, matype=None):
""" Return the bollinger bands values in two
json objects as data and meta_data. It raises ValueError when problems
arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily'
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
nbdevup: The standard deviation multiplier of the upper band. Positive
integers are accepted as default (default=2)
nbdevdn: The standard deviation multiplier of the lower band. Positive
integers are accepted as default (default=2)
matype : Moving average type. By default, matype=0.
Integers 0 - 8 are accepted (check down the mappings) or the string
containing the math type can also be used.
* 0 = Simple Moving Average (SMA),
* 1 = Exponential Moving Average (EMA),
* 2 = Weighted Moving Average (WMA),
* 3 = Double Exponential Moving Average (DEMA),
* 4 = Triple Exponential Moving Average (TEMA),
* 5 = Triangular Moving Average (TRIMA),
* 6 = T3 Moving Average,
* 7 = Kaufman Adaptive Moving Average (KAMA),
* 8 = MESA Adaptive Moving Average (MAMA)
"""
_FUNCTION_KEY = "BBANDS"
return _FUNCTION_KEY, 'Technical Analysis: BBANDS', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_midpoint(self, symbol, interval='daily', time_period=20, series_type='close'):
""" Return the midpoint values in two json objects as
data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "MIDPOINT"
return _FUNCTION_KEY, 'Technical Analysis: MIDPOINT', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_midprice(self, symbol, interval='daily', time_period=20):
""" Return the midprice values in two json objects as
data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
"""
_FUNCTION_KEY = "MIDPRICE"
return _FUNCTION_KEY, 'Technical Analysis: MIDPRICE', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_sar(self, symbol, interval='daily', acceleration=None, maximum=None):
""" Return the midprice values in two json objects as
data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
acceleration: The acceleration factor. Positive floats are accepted (
default 0.01)
maximum: The acceleration factor maximum value. Positive floats
are accepted (default 0.20 )
"""
_FUNCTION_KEY = "SAR"
return _FUNCTION_KEY, 'Technical Analysis: SAR', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_trange(self, symbol, interval='daily'):
""" Return the true range values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
"""
_FUNCTION_KEY = "TRANGE"
return _FUNCTION_KEY, 'Technical Analysis: TRANGE', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_atr(self, symbol, interval='daily', time_period=20):
""" Return the average true range values in two json objects as
data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
"""
_FUNCTION_KEY = "ATR"
return _FUNCTION_KEY, 'Technical Analysis: ATR', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_natr(self, symbol, interval='daily', time_period=20):
""" Return the normalized average true range values in two json objects
as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
time_period: How many data points to average (default 20)
"""
_FUNCTION_KEY = "NATR"
return _FUNCTION_KEY, 'Technical Analysis: NATR', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_ad(self, symbol, interval='daily'):
""" Return the Chaikin A/D line values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
"""
_FUNCTION_KEY = "AD"
return _FUNCTION_KEY, 'Technical Analysis: Chaikin A/D', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_adosc(self, symbol, interval='daily', fastperiod=None,
slowperiod=None):
""" Return the Chaikin A/D oscillator values in two
json objects as data and meta_data. It raises ValueError when problems
arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily'
fastperiod: Positive integers are accepted (default=None)
slowperiod: Positive integers are accepted (default=None)
"""
_FUNCTION_KEY = "ADOSC"
return _FUNCTION_KEY, 'Technical Analysis: ADOSC', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_obv(self, symbol, interval='daily'):
""" Return the on balance volume values in two json
objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
"""
_FUNCTION_KEY = "OBV"
return _FUNCTION_KEY, 'Technical Analysis: OBV', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_ht_trendline(self, symbol, interval='daily', series_type='close'):
""" Return the Hilbert transform, instantaneous trendline values in two
json objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments:
symbol: the symbol for the equity we want to get its data
interval: time interval between two conscutive values,
supported values are '1min', '5min', '15min', '30min', '60min', 'daily',
'weekly', 'monthly' (default 'daily')
series_type: The desired price type in the time series. Four types
are supported: 'close', 'open', 'high', 'low' (default 'close')
"""
_FUNCTION_KEY = "HT_TRENDLINE"
return _FUNCTION_KEY, 'Technical Analysis: HT_TRENDLINE', 'Meta Data'
@av._output_format
@av._call_api_on_func
def get_ht_sine(self, symbol, interval='daily', series_type='close'):
""" Return the Hilbert transform, sine wave values in two
json objects as data and meta_data. It raises ValueError when problems arise
Keyword Arguments: