適当なことを言ってすいません。
でも心理的なものですよ、たぶん。人間が売買する以上は重要ですけどね。
毎日10営業日前までの高値、安値を計算しました。
#!/usr/bin/python # -*- coding: utf-8 -*- import logging from pyalgotrade.technical import highlow from pyalgotrade import strategy from pyalgotrade.barfeed import yahoofeed from pyalgotrade.technical import cross logging.basicConfig(filename='/tmp/exec.log') class MyStrategy(strategy.BacktestingStrategy): def __init__(self, feed, instrument): strategy.BacktestingStrategy.__init__(self, feed) self.__prices = feed[instrument].getPriceDataSeries() self.__high = highlow.High(feed[instrument].getCloseDataSeries(),10) self.__low = highlow.Low(feed[instrument].getCloseDataSeries(),10) self.__instrument = instrument def onBars(self, bars): bar = bars[self.__instrument] self.info("%f Hi:%s Lo:%s" % (self.__prices[-1],self.__high[-1],self.__low[-1])) # Load the yahoo feed from the CSV file feed = yahoofeed.Feed() feed.addBarsFromCSV("orcl", "orcl-2000.csv") # Evaluate the strategy with the feed's bars. myStrategy = MyStrategy(feed, "orcl") myStrategy.run()
2000-11-27 00:00:00 strategy [INFO] 23.125000 Hi:28.875 Lo:22.3125 2000-11-28 00:00:00 strategy [INFO] 22.656250 Hi:28.875 Lo:22.3125 2000-11-29 00:00:00 strategy [INFO] 22.875000 Hi:28.875 Lo:22.3125 2000-11-30 00:00:00 strategy [INFO] 26.500000 Hi:28.8125 Lo:22.3125 2000-12-01 00:00:00 strategy [INFO] 26.437500 Hi:28.8125 Lo:22.3125 2000-12-04 00:00:00 strategy [INFO] 28.187500 Hi:28.1875 Lo:22.3125 2000-12-05 00:00:00 strategy [INFO] 31.500000 Hi:31.5 Lo:22.3125 2000-12-06 00:00:00 strategy [INFO] 30.187500 Hi:31.5 Lo:22.3125 2000-12-07 00:00:00 strategy [INFO] 28.312500 Hi:31.5 Lo:22.65625 2000-12-08 00:00:00 strategy [INFO] 30.062500 Hi:31.5 Lo:22.65625 2000-12-11 00:00:00 strategy [INFO] 31.937500 Hi:31.9375 Lo:22.65625 2000-12-12 00:00:00 strategy [INFO] 30.750000 Hi:31.9375 Lo:22.875 2000-12-13 00:00:00 strategy [INFO] 28.375000 Hi:31.9375 Lo:26.4375 2000-12-14 00:00:00 strategy [INFO] 27.500000 Hi:31.9375 Lo:26.4375 2000-12-15 00:00:00 strategy [INFO] 28.562500 Hi:31.9375 Lo:27.5 2000-12-18 00:00:00 strategy [INFO] 32.000000 Hi:32.0 Lo:27.5 2000-12-19 00:00:00 strategy [INFO] 30.625000 Hi:32.0 Lo:27.5 2000-12-20 00:00:00 strategy [INFO] 28.500000 Hi:32.0 Lo:27.5 2000-12-21 00:00:00 strategy [INFO] 29.500000 Hi:32.0 Lo:27.5 2000-12-22 00:00:00 strategy [INFO] 31.875000 Hi:32.0 Lo:27.5 2000-12-26 00:00:00 strategy [INFO] 30.937500 Hi:32.0 Lo:27.5
0 件のコメント:
コメントを投稿