Beispiel #1
0
def test_01():
    tickers = ['^MERV', 'ALUA', 'BMA', 'BBAR', 'BYMA', 'CVH', 'CEPU', 'CRES', 'EDN', 'GGAL', 'VALO', 'SUPV',
               'MIRG', 'PAMP', 'COME', 'TECO2', 'TXAR', 'TRAN', 'TGNO4', 'TGSUD2', 'YPFD', 'TS', 'APBR']

    tickers = ['TEO', 'DESP', 'MELI', 'GLOB', 'BMA', 'BBAR', 'SUPV', 'GGAL', 'TS',
               'TX', 'PAM', 'EDN', 'CEPU', 'YPF', 'PBR', 'TGS', 'LOMA', 'IRS', 'CRESY']

    BA = False

    for ticker in tickers:
        try:
            if BA == True:
                tck = Ticker(ticker + '.BA', begin=begin)
            else:
                tck = Ticker(ticker, begin=begin)

            a, b, c = tck.get_boll()
            tck.get_ma_close()
            tck.get_volume()
            vol = tck.get_volatility(len_ma=20)
            print(ticker, vol.mean())
            print(tck.get_status_ma())
        except Exception as e:
            print(ticker, 'ERROR', e)

    plt.plot(vol)
    plt.show()
Beispiel #2
0
import sys
import os
import numpy as np

dir_base = os.path.abspath('../')
sys.path.append(dir_base)

from ticker import Ticker

from matplotlib import pyplot as plt

if __name__ == '__main__':
    tck = Ticker('YPF')
    a, b, c = tck.get_boll()
    tck.get_close()
    tck.get_volume()
    vol = tck.get_volatility()
    tck.get_ma_close()
    print(vol.mean())
    print(tck.get_status_ma())
    vol_osc = tck.get_vol_osc()
    # http://pyhogs.github.io/plot-aspect-ratio.html
    plt.figure(figsize=(12.5, 3))
    plt.bar(np.arange(vol_osc.size), vol_osc)
    plt.plot(vol_osc)
    plt.show()

    a, b, c = tck.get_lineal_macd()

    plt.figure(figsize=(12.5, 3))
    plt.plot(a[30:])