예를 들어, 전략적 재검토 (공용 서버를 사용하든 또는 자신의 관리자를 사용하든, 모두 괜찮습니다.
import types
def main():
STATE_IDLE = -1
state = STATE_IDLE
initAccount = ext.GetAccount()
while True:
if state == STATE_IDLE :
n = ext.Cross(FastPeriod,SlowPeriod) # 指标交叉函数
if abs(n) >= EnterPeriod :
opAmount = _N(initAccount.Stocks * PositionRatio,3)
Dict = ext.Buy(opAmount) if n > 0 else ext.Sell(opAmount)
if Dict :
opAmount = Dict['amount']
state = PD_LONG if n > 0 else PD_SHORT
Log("开仓详情",Dict,"交叉周期",n)
else:
n = ext.Cross(ExitFastPeriod,ExitSlowPeriod) # 指标交叉函数
if abs(n) >= ExitPeriod and ((state == PD_LONG and n < 0) or (state == PD_SHORT and n > 0)) :
nowAccount = ext.GetAccount()
Dict2 = ext.Sell(nowAccount.Stocks - initAccount.Stocks) if state == PD_LONG else ext.Buy(initAccount.Stocks - nowAccount.Stocks)
state = STATE_IDLE
nowAccount = ext.GetAccount()
LogProfit(nowAccount.Balance - initAccount.Balance,'钱:',nowAccount.Balance,'币:',nowAccount.Stocks,'平仓详情:',Dict2,'交叉周期:',n)
Sleep(Interval * 1000)
이 글은 이 사이트에서 직접 복사할 수 있습니다.
import types
import talib # 改动 引用 talib 库
def main():
STATE_IDLE = -1
state = STATE_IDLE
initAccount = ext.GetAccount()
while True:
records = exchange.GetRecords()
ma = talib.MA(records.Close) # 改动 ,调用 talib 库的 MA 函数 即 均线指标计算
LogStatus("均值" + str(ma))
if state == STATE_IDLE :
n = ext.Cross(FastPeriod,SlowPeriod) # 指标交叉函数
if abs(n) >= EnterPeriod :
opAmount = _N(initAccount.Stocks * PositionRatio,3)
Dict = ext.Buy(opAmount) if n > 0 else ext.Sell(opAmount)
if Dict :
opAmount = Dict['amount']
state = PD_LONG if n > 0 else PD_SHORT
Log("开仓详情",Dict,"交叉周期",n)
else:
n = ext.Cross(ExitFastPeriod,ExitSlowPeriod) # 指标交叉函数
if abs(n) >= ExitPeriod and ((state == PD_LONG and n < 0) or (state == PD_SHORT and n > 0)) :
nowAccount = ext.GetAccount()
Dict2 = ext.Sell(nowAccount.Stocks - initAccount.Stocks) if state == PD_LONG else ext.Buy(initAccount.Stocks - nowAccount.Stocks)
state = STATE_IDLE
nowAccount = ext.GetAccount()
LogProfit(nowAccount.Balance - initAccount.Balance,'钱:',nowAccount.Balance,'币:',nowAccount.Stocks,'平仓详情:',Dict2,'交叉周期:',n)
Sleep(Interval * 1000)
정책에서 talib.MA (즉, talib 라이브러리를 사용) 을 호출하면, 자신의 호스트 회귀를 사용하거나 실 디스크 정책을 실행할 때 다음과 같은 오류가 발생합니다.
이 사이트의 사용자들은 “공용 서버를 이용해서 추적하는 건 문제없어요!“라고 말할 수 있습니다. : 네! 왜냐하면 talib 라이브러리가 퍼블릭 서버에 이미 설치되어 있기 때문입니다.
자, 자, 자, 자, 자, 자. 다음 예시는 windows XP 시스템 (즉 32 비트 windows) 의 Python 2.7 환경에서 talib 라이브러리를 설치하는 것입니다. 온라인에서 더 많은 방법이 있는데, 여기서는 좀 더 간단한 방법이 사용되고 있습니다.
참고: win32 버전 Python 2.7 설치 패키지를 다운로드하십시오.
설치할 때 주의할 점은 자동으로 설정 환경 변수 옵션을 선택하면 pip 컴포넌트가 기본으로 설치되어 있다.
인터넷에서 검색한 자료입니다.
python wheel怎么安装?
小灰机289 | 浏览 14404 次
推荐于2016-01-19 03:17:24 最佳答案
你装了pip吗,建议先装pip,后面安装各种python库就很方便了。
打开命令行窗口,输入下面的命令:
pip install wheel
这时pip会自动在网络上下载安装wheel。
安装完成后可以敲下面的命令查看是否安装成功:
pip freeze
이 문서는 http://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib에서 다운로드 되었습니다.
해당 버전과 시스템에 해당하는 talib 파일을 찾기 위해 아래와 같이:
다음 그림과 같이 설치합니다.
다운로드 numpy 이 문서는 http://www.lfd.uci.edu/~gohlke/pythonlibs/#ta-lib에서 다운로드 되었습니다.
설치:
#### 발명자의 수량에서 시도해 볼 수 있습니다, 전략은 talib의 지표 함수를 사용
이제 LogStatus의 출력이 나타납니다.
압축 후