Skip to Content
Python算法交易
book

Python算法交易

by Yves Hilpisch
November 2022
Intermediate to advanced
392 pages
10h 8m
Chinese
China Electric Power Press Ltd.
Content preview from Python算法交易
使用
FXCM
进行外汇交易
|
275
9.1
入门
FXCM API
的详细文档位于
https://fxcm.github.io/rest-api-docs
。要安装
Python
程序
包
fxcmpy
,请在
shell
上执行:
pip install fxcmpy
fxcmpy
软件包的文档可在
http://fxcmpy.tpq.io
上找到。
使用
FXCM
的免费模拟账户就可以开始使用
FXCM
交易
API
和
fxcmpy
软件包了。
请注意,
FXCM
模拟账户仅在某些国家
/
地区提供(
https://oreil.ly/v9H6z
)。
注
1
接
下来就是在演示账户中创建唯一的
API
令牌(例如
YOUR_FXCM_API_TOKEN
)。然后
通过下面的方式打开与
API
的连接:
import fxcmpy
api = fxcmpy.fxcmpy(access_token=YOUR_FXCM_API_TOKEN, log_level='error')
另外,你也可以使用第
8
章中创建的配置文件连接到
API
。该文件的内容如下:
[FXCM]
log_level = error
log_file = PATH_TO_AND_NAME_OF_LOG_FILE
access_token = YOUR_FXCM_API_TOKEN
然后可以通过以下方式连接到
API
:
import fxcmpy
api = fxcmpy.fxcmpy(config_file='pyalgo.cfg')
默认情况下是连接到演示服务器。但是,通过使用
server
参数,可以建立与实时交 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.

Read now

Unlock full access

More than 5,000 organizations count on O’Reilly

AirBnbBlueOriginElectronic ArtsHomeDepotNasdaqRakutenTata Consultancy Services

QuotationMarkO’Reilly covers everything we've got, with content to help us build a world-class technology community, upgrade the capabilities and competencies of our teams, and improve overall team performance as well as their engagement.
Julian F.
Head of Cybersecurity
QuotationMarkI wanted to learn C and C++, but it didn't click for me until I picked up an O'Reilly book. When I went on the O’Reilly platform, I was astonished to find all the books there, plus live events and sandboxes so you could play around with the technology.
Addison B.
Field Engineer
QuotationMarkI’ve been on the O’Reilly platform for more than eight years. I use a couple of learning platforms, but I'm on O'Reilly more than anybody else. When you're there, you start learning. I'm never disappointed.
Amir M.
Data Platform Tech Lead
QuotationMarkI'm always learning. So when I got on to O'Reilly, I was like a kid in a candy store. There are playlists. There are answers. There's on-demand training. It's worth its weight in gold, in terms of what it allows me to do.
Mark W.
Embedded Software Engineer

You might also like

人工智能技术与大数据

人工智能技术与大数据

Posts & Telecom Press, Anand Deshpande, Manish Kumar
图解大模型 : 生成式AI 原理与实战

图解大模型 : 生成式AI 原理与实战

Jay Alammar, Maarten Grootendorst

Publisher Resources

ISBN: 9787519869694