MA, SMA, EMA

MA: Moving Average. 移動平均線

SMA: Simple Moving Average 簡單移動平均

EMA: Exponential Moving Average.  指數移動平均

#!/usr/bin/env python
# -*- coding=utf-8 -*-
__author__ = "柯博文老師 Powen Ko, www.powenko.com"
# EMA https://towardsdatascience.com/implementing-moving-averages-in-python-1ad28e636f9d

import pandas as pd
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
import pyEX as p
# https://iexcloud.io/  申請免費帳號

TOKEN="xxxxxxx"
c = p.Client(api_token=TOKEN)


ticker = 'AMD'
timeframe = '6m'
df = c.chartDF(ticker, timeframe)
df = df[['close']]
df.reset_index(level=0, inplace=True)
df.columns=['ds','y']
plt.plot(df.ds, df.y, label='AMD')
plt.show()
 

量化分析投資
CH01 名詞解釋CH02 投資資訊