ต้องการสร้างแอปพลิเคชัน iPhone/Android หรือวิดเจ็ต Facebook ใช่ไหม? ตอนนี้คุณสามารถทำได้ด้วย Myfxbook API API ช่วยให้คุณเข้าถึงข้อมูลบัญชีของคุณโดยใช้โปรแกรมและสร้างแอปพลิเคชันที่คุณกำหนดเองได้
- เซสชันจะไม่หมดอายุ เพื่อจบอายุเซสชัน ให้ใช้วิธีการออกจากระบบ
- ใช้ 'debug=1' ในประเภท JSON เพื่อการพัฒนาที่ง่ายขึ้น (ข้อความธรรมดาและถูกจัดรูปแบบ)
- ใช้การเชื่อมต่อที่ปลอดภัย (HTTPS) เพื่อความปลอดภัยสูงสุด
- ในกรณีที่เกิดข้อผิดพลาด ให้ตรวจสอบฟิลด์ 'ข้อความ' เพื่อหาสาเหตุ
- การประทับเวลาการทำธุรกรรม (คำสั่ง/การเทรดที่เปิดอยู่ ประวัติ จุดข้อมูลสำหรับกำไร/ยอดคงเหลือรายวัน) อยู่ในเขตเวลาของโบรกเกอร์ท้องถิ่น
- ฟิลด์การตอบกลับทั้งหมดมีคำอธิบายในตัว 'รหัส' คือรหัสของเอนทิตี 'accountId' คือหมายเลขบัญชี
- ประเภทการกำหนดขนาดสามารถเป็นล็อตหรือหน่วยก็ได้ (บัญชี OANDA)
- API อนุญาตให้เข้าถึงข้อมูลส่วนบุคคลเท่านั้น
API ประกอบด้วยวิธีการต่อไปนี้:
Methods | คำอธิบาย | ความคิดเห็น |
---|---|---|
Login | เข้าสู่ระบบบัญชีของคุณ | Creates a new session. |
Logout | ออกจากระบบบัญชีของคุณ | เซสชันปัจจุบันไม่ถูกต้อง |
get-my-accounts | รับรายชื่อบัญชีของฉันและข้อมูล | |
get-watched-accounts | รับรายชื่อบัญชีที่ฉันเฝ้าดู | |
get-open-trades | รับการเทรดที่เปิดอยู่สำหรับบัญชี | |
get-open-orders | รับคำสั่งที่เปิดอยู่สำหรับบัญชี | |
get-history | รับประวัติสำหรับบัญชี | ประวัติถูกจำกัดไว้ที่ม 50 ธุรกรรล่าสุด |
get-daily-gain | Get daily gain values. | ใช้เพื่อสร้างแผนภูมิการเติบโต |
get-gain | รับค่ากำไรระหว่างวันที่ | |
get-custom-widget | รับวิดเจ็ตที่กำหนดเอง | ใช้เพื่อสร้างวิดเจ็ตแบบกำหนดเองของยอดคงเหลือหรือแผนภูมิการเติบโตของบัญชี |
get-community-outlook | รับข้อมูลแนวโน้มของชุมชน | Free version up to 100 requests per 24 hours. Paid version up to 2880 requests per 24 hours. |
get-community-outlook-by-country | รับแนวโน้มของชุมชนตามข้อมูลประเทศ | ต้องระบุชื่อสัญลักษณ์ |
get-data-daily | รับข้อมูลรายวัน | ใช้เพื่อสร้างแผนภูมิการเติบโต ยอดคงเหลือ ค่าสัมบูรณ์ หรือกำไร |
มีข้อผิดพลาดที่เป็นไปได้หลายประเภท:
- ฟิลด์ที่จำเป็นขาดหายไป
- อีเมล/รหัสผ่านไม่ถูกต้อง
- เซสชันไม่ถูกต้อง
- บัญชีไม่ถูกต้อง
เนื่องจากเรามุ่งมั่นที่ Myfxbook เพื่อทำให้บริการของเราไม่เสียค่าใช้จ่ายใด ๆ ซอฟต์แวร์ใด ๆ ที่คุณพัฒนาควรเป็นแบบฟรี แอปพลิเคชั่นที่ออกแบบมาอย่างดีและทำงานได้อย่างถูกต้องจะปรากฏในพื้นที่แอปพลิเคชันของเรา (ในเร็ว ๆ นี้)
โปรดใช้ส่วนการเขียนโปรแกรมเพื่อโพสต์คำถามเกี่ยวกับ API
เมื่อใช้ Myfxbook API แสดงว่าคุณยอมรับเงื่อนไขการใช้งาน
Current version of the API is v1.37 (July 19, 2020) - Please check back once in a while for changes and updates.
07/19/20 - get-community-outlook has now two versions - in the free version it is limited to 100 requests per 24 hours while the paid version limit is increased to 2800 requests per 24 hours.
10/04/12 - get-daily-balance method deprecated, added pips to
get-my-accounts, added get-data-daily. Version changed to 1.37
11/27/11 - added profit factor to get-my-accounts method. Version
changed to
1.36
09/21/11 - added currency to get-my-accounts method. Version changed
to 1.35
08/23/11 - added get-gain. Version changed to 1.34
08/07/11 - added profit to Daily Gain . Version changed to 1.33
06/23/11 - added invitationUrl . Version changed to 1.32
05/18/11 - added comment to open orders method and to open trades
method.
Version
changed to
1.31
03/27/11 - added commission to get-my-accounts method. Added
interest and
commission to
get-history method. Version changed to v1.3
11/14/10 - added avgLongPrice/avgShortPrice to get-community-outlook
method.
Version
changed
to
v1.2
11/01/10 - get-community-outlook and get
get-community-outlook-by-country
added.
Version
changed
to v1.1
10/03/10 - firstTradeDate added. Version changed to v1.03
06/27/10 - get-custom-widget added. Version changed to v1.02
05/23/10 - get-watched-accounts added. Version Changed to v1.01
04/11/10 - gmtOffset field deprecated.
พารามิเตอร์ | คำอธิบาย |
---|---|
อีเมลของผู้ใช้ | |
password | รหัสผ่านของผู้ใช้ |
คำขอ:
https://www.myfxbook.com/api/[email protected]&password=letsboogie
การตอบสนอง:
<response error="false" message=""> <session>DSL07vu14QxHWErTIAFrH40></session> </response>
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
คำขอ:
https://www.myfxbook.com/api/logout.xml?session=DSL07vu14QxHWErTIAFrH40
การตอบสนอง:
<response error="false" message="Logged out."></response>
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
คำขอ:
https://www.myfxbook.com/api/get-my-accounts.xml?session=DSL07vu14QxHWErTIAFrH40
การตอบสนอง:
<response error="false" message=""> <accounts> <account> <id>12345</id> <name>Holy Grail</name> <description> Super duper MA+CCI trading system. </description> <accountId>1013230</accountId> <gain>8.92</gain> <absGain>8.92</absGain> <daily>0.04</daily> <monthly>1.25</monthly> <withdrawals>0.00</withdrawals> <deposits>10000.00</deposits> <interest>11.10</interest> <profit>892.45</profit> <balance>10892.45</balance> <drawdown>53.53</drawdown> <equity>10892.45</equity> <demo>true</demo> <lastUpdateDate>03/01/2010 10:14</lastUpdateDate> <creationDate>08/06/2009 08:13</creationDate> <firstTradeDate>04/21/2008 11:58</firstTradeDate> <tracking>21</tracking> <views>549</views> <commission>0</commission> <currency>USD</currency> <profitFactor>0.16</profitFactor> <pips>81.20</pips> <invitationUrl>https://www.myfxbook.com/members/john101/anyone/347/SDa45X5TSkdIsXg8</invitationUrl> <server> <name>Alpari UK</name> </server> </account> </accounts> </response>
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
คำขอ:
https://www.myfxbook.com/api/get-watched-accounts.xml?session=DSL07vu14QxHWErTIAFrH40
การตอบสนอง:
<response error="false" message=""> <accounts> <account> <name>Holy Grail</name> <gain>8.92</gain> <drawdown>53.53</drawdown> <demo>true</demo> <change>1.53</change> </account> </accounts> </response>
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
คำขอ:
https://www.myfxbook.com/api/get-open-orders.xml?session=DSL07vu14QxHWErTIAFrH40&id=12345
การตอบสนอง:
<response error="false" message=""> <openOrders> <order> <openDate>03/01/2010 13:52</openDate> <symbol>GBPUSD</symbol> <action>Sell Limit</action> <sizing> <type>lots</type> <value>0.08</value> </sizing> <openPrice>1.4932</openPrice> <tp>1.48820</tp> <sl>0.00000</sl> <comment>Best trade ever</comment> </order> </openOrders> </response>
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
คำขอ:
https://www.myfxbook.com/api/get-open-trades.xml?session=DSL07vu14QxHWErTIAFrH40&id=12345
การตอบสนอง:
<response error="false" message=""> <opentrades> <trade> <openDate>03/01/2010 13:39</openDate> <symbol>GBPUSD</symbol> <action>Sell</action> <sizing> <type>lots</type> <value>0.01</value> </sizing> <openPrice>1.4802</openPrice> <tp>1.4832</tp> <sl>0</sl> <profit>-10.8</profit> <pips>-108.0</pips> <swap>0.0</swap> <comment>Best trade ever</comment> <magic>24129962</magic> </trade> </opentrades> </response>
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
คำขอ:
https://www.myfxbook.com/api/get-history.xml?session=DSL07vu14QxHWErTIAFrH40&id=12345
การตอบสนอง:
<response error="false" message=""> <history> <transaction> <openDate>03/01/2010 14:13</openDate> <closeDate>03/01/2010 15:26</closeDate> <symbol>GBPUSD</symbol> <action>Buy Limit</action> <sizing> <type>lots</type> <value>0.04</value> </sizing> <openPrice>1.48310</openPrice> <closePrice>1.49340</closePrice> <tp>1.48810</tp> <sl>0.00000</sl> <pips>0.0</pips> <profit>0.00</profit> <comment>Best trade ever</comment> <interest>12.1</interest> <commission>0</commission> </transaction> </history> </response>
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
start | Start date, format: yyyy-mm-dd |
end | End date, format: yyyy-mm-dd |
คำขอ:
https://www.myfxbook.com/api/get-daily-gain.xml?session=DSL07vu14QxHWErTIAFrH40&id=12345&start=2000-01-01&end=2010-01-01
การตอบสนอง:
<response error="false" message=""> <dailyGain> <gain> <date>02/01/2010</date> <value>0.07</value> <profit>0.03</profit> </gain> </dailyGain> </response>
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
start | Start date, format: yyyy-mm-dd |
end | End date, format: yyyy-mm-dd |
คำขอ:
https://www.myfxbook.com/api/get-gain.xml?session=DSL07vu14QxHWErTIAFrH40&id=12345&start=2000-01-01&end=2010-01-01
การตอบสนอง:
<response error="false" message=""> <value>86.69</value> </response>
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
width | ความกว้างของวิดเจ็ต |
height | ความสูงของวิดเจ็ต |
bgcolor | สีพื้นหลัง |
chartbgc | สีพื้นหลังของแผนภูมิ |
gridcolor | สีตาราง |
linecolor | สีของเส้น |
barcolor | สีของแท่ง |
fontcolor | สีตัวอักษร |
bart | ชื่อแท่ง |
linet | ชื่อบรรทัด |
charttitle | ชื่อแผนภูมิ |
titles | ขนาดตัวอักษรของชื่อเรื่อง |
คำขอ:
https://widgets.myfxbook.com/api/get-custom-widget.png?session=DSL07vu14QxHWErTIAFrH40&id=12345&width=300&height=200&bart=1&linet=0&bgColor=000000&gridColor=BDBDBD&lineColor=00CB05&barColor=FF8D0A&fontColor=FFFFFF&title=&titles=20&chartbgc=474747
การตอบสนอง: (ตัวอย่างเท่านั้น)
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
*ค่าสกุลเงินแสดงเป็น USD ($)
คำขอ:
https://www.myfxbook.com/api/get-community-outlook.xml?session=DSL07vu14QxHWErTIAFrH40
การตอบสนอง:
<response error="false" message=""> <community-outlook> <symbols> <symbol> <name>EURUSD</name> <shortPercentage>55</shortPercentage> <longPercentage>44</longPercentage> <shortVolume>1142.58</shortVolume> <longVolume>905.47</longVolume> <longPositions>2932</longPositions> <shortPositions>3888</shortPositions> <totalPositions>2048</totalPositions> <avgShortPrice>1.3808</avgShortPrice> <avgLongPrice>1.4097</avgLongPrice> </symbol> </symbols> <general> <demoAccountsPercentage>43</demoAccountsPercentage> <realAccountsPercentage>56</realAccountsPercentage> <profitablePercentage>54</profitablePercentage> <nonProfitablePercentage>45</nonProfitablePercentage> <fundsWon>6,819,251.63</fundsWon> <fundsLost>-8,740,646.15</fundsLost> <averageDeposit>21,740.16</averageDeposit> <averageAccountProfit>4,127.88</averageAccountProfit> <averageAccountLoss>-5,290.95</averageAccountLoss> <totalFunds>35,914,737.56</totalFunds> </general> </community-outlook> </response>
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
symbol | ชื่อสัญลักษณ์ |
คำขอ:
https://www.myfxbook.com/api/get-community-outlook-by-country.xml?session=DSL07vu14QxHWErTIAFrH40&symbol=eurusd
การตอบสนอง:
<response error="false" message=""> <community-outlook-by-country> <countries> <country> <name>GERMANY</name> <code>DE</code> <longVolume>13.71</longVolume> <shortVolume>35.76</shortVolume> <longPositions>111</longPositions> <shortPositions>489</shortPositions> </country> </countries> </community-outlook-by-country> </response>
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
start | Start date, format: yyyy-mm-dd |
end | End date, format: yyyy-mm-dd |
คำขอ:
https://www.myfxbook.com/api/get-data-daily.xml?session=DSL07vu14QxHWErTIAFrH40&id=12345&start=2000-01-01&end=2010-01-01
การตอบสนอง:
<response error="false" message=""> <dataDaily> <data> <date>02/01/2010</date> <balance>25083.56</balance> <pips>83.30</pips> <lots>0.41</lots> <floatingPL>-500.00</floatingPL> <profit>84.7400</profit> <growthEquity>-4.15</growthEquity> <floatingPips>1.00</floatingPips> </data> </dataDaily> </response>
พารามิเตอร์ | คำอธิบาย |
---|---|
อีเมลของผู้ใช้ | |
password | รหัสผ่านของผู้ใช้ |
คำขอ:
https://www.myfxbook.com/api/[email protected]&password=letsboogie
การตอบสนอง:
{ "error": false, "message": "", "session": "DSL07vu4QxHWErTIAFrH40" }
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
คำขอ:
https://www.myfxbook.com/api/logout.json?session=DSL07vu14QxHWErTIAFrH40
การตอบสนอง:
{ "error": false, "message": "Logged out." }
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
คำขอ:
https://www.myfxbook.com/api/get-my-accounts.json?session=DSL07vu14QxHWErTIAFrH40
การตอบสนอง:
{ "error": false, "message": "", "accounts": [ { "id": 12345, "name": "Holy Grail", "description": "Super duper MA+CCI trading system.", "accountId": 1013230, "gain": 8.92, "absGain": 8.92, "daily": "0.04", "monthly": "1.25", "withdrawals": 0, "deposits": 10000, "interest": 11.1, "profit": 892.45, "balance": 10892.45, "drawdown": 53.53, "equity": 10892.45, "equityPercent": 100, "demo": true, "lastUpdateDate": "03/01/2010 10:14", "creationDate": "08/06/2009 08:13", "firstTradeDate": "04/21/2008 12:18", "tracking": 21, "views": 549, "commission":0, "currency":"USD", "profitFactor": 0.3, "pips": 81.20, "invitationUrl": "https://www.myfxbook.com/members/john101/anyone/347/SDa45X5TSkdIsXg8", "server": { "name": "Alpari UK" } } ] }
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
คำขอ:
https://www.myfxbook.com/api/get-watched-accounts.json?session=DSL07vu14QxHWErTIAFrH40
การตอบสนอง:
{ "error": false, "message": "", "accounts": [ { "name": "Holy Grail", "gain": 8.92, "drawdown": 53.53, "demo": true, "change": 1.53, } ] }
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
คำขอ:
https://www.myfxbook.com/api/get-open-orders.json?session=DSL07vu14QxHWErTIAFrH40&id=12345
การตอบสนอง:
{ "error": false, "message": "", "openOrders": [ { "openTime": "03/01/2010 13:52", "symbol": "GBPUSD", "action": "Sell Limit", "sizing": { "type": "lots", "value": "0.08" }, "openPrice": 1.4932, "tp": 1.4882, "sl": 0, "comment":"Best trade ever" } ] }
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
คำขอ:
https://www.myfxbook.com/api/get-open-trades.json?session=DSL07vu14QxHWErTIAFrH40&id=12345
การตอบสนอง:
{ "error": false, "message": "", "openTrades": [ { "openTime": "03/01/2010 13:39", "symbol": "GBPUSD", "action": "Sell", "sizing": { "type": "lots", "value": "0.01" }, "openPrice": 1.4802, "tp": 1.4832, "sl": 0, "comment":"best trade ever", "profit": -10.8, "pips": -108, "swap": 0, "magic": 24129962 } ] }
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
คำขอ:
https://www.myfxbook.com/api/get-history.json?session=DSL07vu14QxHWErTIAFrH40&id=12345
การตอบสนอง:
{ "error": false, "message": "", "history": [ { "openTime": "03/01/2010 14:13", "closeTime": "03/01/2010 15:26", "symbol": "GBPUSD", "action": "Buy Limit", "sizing": { "type": "lots", "value": "0.04" }, "openPrice": 1.4831, "closePrice": 1.4934, "tp": 1.4881, "sl": 0, "comment":"best trade ever", "pips": 0, "profit": 0, "interest": 12.1, "commission": 0 } ] }
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
start | Start date, format: yyyy-mm-dd |
end | End date, format: yyyy-mm-dd |
คำขอ:
https://www.myfxbook.com/api/get-daily-gain.json?session=DSL07vu14QxHWErTIAFrH40&id=12345&start=2000-01-01&end=2010-01-01
การตอบสนอง:
{ "error": false, "message": "", "dailyGain": [ [ { "date": "02/01/2010", "value": 0.07, "profit": 0.03 }] ] }
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
start | Start date, format: yyyy-mm-dd |
End | End date, format: yyyy-mm-dd |
คำขอ:
https://www.myfxbook.com/api/get-gain.json?session=DSL07vu14QxHWErTIAFrH40&id=12345&start=2000-01-01&end=2010-01-01
การตอบสนอง:
{ "error": false, "message": "", "value": 86.69 }
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
width | ความกว้างของวิดเจ็ต |
height | ความสูงของวิดเจ็ต |
bgcolor | สีพื้นหลัง |
chartbgc | สีพื้นหลังของแผนภูมิ |
gridcolor | สีตาราง |
linecolor | สีของเส้น |
barcolor | สีของแท่ง |
fontcolor | สีตัวอักษร |
bart | ชื่อแท่ง |
linet | ชื่อบรรทัด |
charttitle | ชื่อแผนภูมิ |
titles | ขนาดตัวอักษรของชื่อเรื่อง |
คำขอ:
https://widgets.myfxbook.com/api/get-custom-widget.png?session=DSL07vu14QxHWErTIAFrH40&id=12345&width=300&height=200&bart=1&linet=0&bgColor=000000&gridColor=BDBDBD&lineColor=00CB05&barColor=FF8D0A&fontColor=FFFFFF&title=&titles=20&chartbgc=474747
การตอบสนอง:
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
คำขอ:
https://www.myfxbook.com/api/get-community-outlook.json?session=DSL07vu14QxHWErTIAFrH40
การตอบสนอง:
{ "error": false, "message": "", "symbols": [ { "name": "EURUSD", "shortPercentage": 55, "longPercentage": 44, "shortVolume": 1142.58, "longVolume": 905.47, "longPositions": 2932, "shortPositions": 3888, "totalPositions": 2048, "avgShortPrice":1.3808, "avgLongPrice":1.4097 } ], "general": { "demoAccountsPercentage": 43, "realAccountsPercentage": 56, "profitablePercentage": 54, "nonProfitablePercentage": 45, "fundsWon": "6,819,251.63", "fundsLost": "-8,740,646.15", "averageDeposit": "21,740.16", "averageAccountProfit": "4,127.88", "averageAccountLoss": "-5,290.95", "totalFunds": "35,914,737.56" } }
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
symbol | ชื่อสัญลักษณ์ |
คำขอ:
https://www.myfxbook.com/api/get-community-outlook-by-country.json?session=DSL07vu14QxHWErTIAFrH40&symbol=eurusd
การตอบสนอง:
{ "error": false, "message": "", "countries": [ { "name": "GERMANY", "code": "DE", "longVolume": 13.71, "shortVolume": 35.76, "longPositions": 111, "shortPositions": 489 } ] }
พารามิเตอร์ | คำอธิบาย |
---|---|
session | Session ID |
id | Account ID |
start | Start date, format: yyyy-mm-dd |
end | End date, format: yyyy-mm-dd |
คำขอ:
https://www.myfxbook.com/api/get-data-daily.json?session=DSL07vu14QxHWErTIAFrH40&id=12345&start=2000-01-01&end=2010-01-01
การตอบสนอง:
{ "error": false, "message": "", "dataDaily": [ [ { "date": "02/01/2010", "balance": 25083.56, "pips": 83.30, "lots": 0.41, "floatingPL": -500.00, "profit": 84.7400, "growthEquity": -4.15, "floatingPips": 1.00 }] ] }