Rest Api

Any Contract, Available History.Supported Contracts
AuthCode Information And Package Consumption Details:Query
Code Example:Download Example

Single Contract Query

Single Contract Query,With Last Transaction Detail,With Last K Data
Command
Url:http://map.fxnapi.com:10002/queryrm/single
Method:GET
Auth:HttpHeader Authorization=AuthCode or AuthCode Trans By QueryString,Reference
Request Args:
nametyperequiredremark
symbolstringyesFull Symbol Code Such As EURUSD,Reference
withticksintnoWith Lastest Transaction Detail(Default 0 No,1 Yes)
withksintnoWith Lastest K Data(Default 0 No,1 Yes)
Request Sample
http://map.fxnapi.com:10002/queryrm/single?symbol=EURUSD&withticks=0&withks=0
http://map.fxnapi.com:10002/queryrm/single?symbol=EURUSD&withticks=0&withks=0&token=AuthCode
Response:
nametyperemark
Codeintsucc when Code>=0
Msgstringmessage
Objdata objectReal Data Model
Response Sample
{"Code":0,"Msg":"","Obj":{"TS":"1561417986,6.87330,2,0;1561417987,6.87330,2,0;1561418227,6.87340,1,1;1561418227,6.87340,2,0;1561418227,6.87352,1,1;1561418237,6.87349,1,-1;1561418239,6.87349,1,0;1561418246,6.87347,1,-1;1561418255,6.87346,1,-1;1561418261,6.87344,1,-1;1561418273,6.87341,1,-1;1561418279,6.87339,1,-1;1561418286,6.87360,1,1;1561418287,6.87350,3,-1;1561418347,6.87360,1,1","N":"","M":"","S":"USDCNH","C":"","FS":"USDCNH","P":6.87360,"NV":0,"Tick":1561418347,"B1":6.87360,"B2":0,"B3":0,"B4":0,"B5":0,"B1V":0,"B2V":0,"B3V":0,"B4V":0,"B5V":0,"S1":6.87570,"S2":0,"S3":0,"S4":0,"S5":0,"S1V":0,"S2V":0,"S3V":0,"S4V":0,"S5V":0,"ZT":0,"DT":0,"O":6.87558,"H":6.87558,"L":6.87118,"YC":6.87432,"A":0,"V":369,"OV":0,"IV":0,"SY":0.000,"SJ":0,"HS":0,"ZS":0,"LS":0,"Z":0.00,"Z2":0.00,"VF":0.064,"ZF":-0.010,"JS":0,"YJS":0,"HD":0,"YHD":0,"AVP":0,"A1":""}}

Mutilple Contracts Query

Multiple Contract Query(up to 10), Please use queryrm/vols for stocks(up to 50)
Command
Url:http://map.fxnapi.com:10002/queryrm/multiple
Url:http://map.fxnapi.com:10002/queryrm/vols (only for stocks)
Method:GET
Auth:HttpHeader Authorization=AuthCode or AuthCode Trans By QueryString,Reference
Request Args:
nametyperequiredremark
symbolsstringyesContracts Split By ',' Such as 'H600138,BTC,USDCNH',Reference
Request Sample
http://map.fxnapi.com:10002/queryrm/multiple?symbols=BTC,EURUSD,USDJPY
http://map.fxnapi.com:10002/queryrm/multiple?symbols=BTC,EURUSD,USDJPY&token=AuthCode
Response:
nametyperemark
Codeintsucc when Code>=0
Msgstringmessage
ObjarrayArray of Real Data Model
Response Sample
{"Code":0,"Msg":"","Obj":[{Model1},{Model2},{Model3}]}

Pagination Contracts Query

Pagination Contracts Query,Every Page Up to 10, Please use queryrm/searchvol for stocks(up to 50)
Command
Url:http://map.fxnapi.com:10002/queryrm/search
Url:http://map.fxnapi.com:10002/queryrm/searchvol (only for stocks)
Method:GET
Auth:HttpHeader Authorization=AuthCode or AuthCode Trans By QueryString,Reference
Request Args:
nametyperequiredremark
wherestringyesfuzzy keyword
psintyesPage Size
pintyesPage Index
sortstringnoFields Reference
sorttypeintno0 Asc,1 Desc(Default 0)
Request Sample
http://map.fxnapi.com:10002/queryrm/search?rout=&p=1&ps=10&market=&where=abc&sort=&sorttype=
http://map.fxnapi.com:10002/queryrm/search?rout=&p=1&ps=10&market=&where=abc&sort=&sorttype=&token=AuthCode
Response:
nametyperemark
Codeintsucc when Code>=0
Msgstringmessage
ObjarrayArray of Real Data Model
Response Sample
{"Code":0,"Msg":"","Obj":[{Model1},{Model2},{Model3}]}

HistoryQuery By Pagination (return Json)

Sort From Now To Before。The First Page Could Option with The Dynamic K Data。Period D up to 10 Year,Period 1 Minute up to 30 Days,Period 5 Minute and Hours up to 180 Days
Command
Url:http://map.fxnapi.com:10002/querykm/jsonbypage
Method:GET
Auth:HttpHeader Authorization=AuthCode or AuthCode Trans By QueryString,Reference
Request Args:
nametyperequiredremark
symbolstringyesFull Symbol Cocde Such As BTC,Reference
periodstringyesSupport 1M,3M,5M,10M,15M,30M,1H,2H,4H,D,(W,M Maybe Not)
pidxintyesPage Index
psizeintyesPage Size,Up to 500
withlastintnoWith the Dynamic K Data(Default 0 No, 1 Yes),For the First Page
Request Sample
http://map.fxnapi.com:10002/querykm/jsonbypage?symbol=BTC&period=D&pidx=1&psize=100&withlast=0
http://map.fxnapi.com:10002/querykm/jsonbypage?symbol=BTC&period=D&pidx=1&psize=100&withlast=0&token=AuthCode
Response:
nametyperemark
Codeintsucc when Code>=0
Msgstringmessage
ObjstringJson Array KData [{"C":close,"Tick":timeticks,"O":open,"H":high,"L":low,"A":amount,"V":volume}...]
Response Sample
{"Code":0,"Msg":"","Obj":[{"C":27696.84,"Tick":1679241600,"O":27554.25,"H":28472.00,"L":27124.47,"A":14889767035.22,"V":533099.58},{"C":27549.17,"Tick":1679155200,"O":27227.48,"H":27750.00,"L":26578.00,"A":8588080273.79,"V":316148.14}...]}

HistoryQuery By Timeframe (return Json)

Sort From Start Time To End Time。Period D up to 10 Year,Period 1 Minute up to 30 Days,Period 5 Minute and Hours up to 180 Days
Up to 500 Period Unit,Support Period 1M,3M,5M,10M,15M,30M,1H,2H,4H,D,(W,M Maybe Not)
Command
Url:http://map.fxnapi.com:10002/querykm/jsonbytimeframe
Method:GET
Auth:HttpHeader Authorization=AuthCode or AuthCode Trans By QueryString,Reference
Request Args:
nametyperequiredremark
symbolstringyesFull Symbol Cocde Such As BTC,Reference
periodstringyesSupport 1M,3M,5M,10M,15M,30M,1H,2H,4H,D,(W,M Maybe Not)
dateststringyesStart Time
dateedstringyesEnd Time
withlastintnoWith The Dynamic KData(Default 0 No, 1 Yes), Valid when dateed>=Now
Request Sample
http://map.fxnapi.com:10002/querykm/jsonbytimeframe?symbol=BTC&period=D&datest=2019-05-01 12:00:00&dateed=2019-05-02 12:00:00&withlast=0
http://map.fxnapi.com:10002/querykm/jsonbytimeframe?symbol=BTC&period=D&datest=2019-05-01 12:00:00&dateed=2019-05-02 12:00:00&withlast=0&token=AuthCode
Response:
nametyperemark
Codeintsucc when Code>=0
Msgstringmessage
ObjstringJson Array KData [{"C":close,"Tick":timeticks,"O":open,"H":high,"L":low,"A":amount,"V":volume}...]
Response Sample
{"Code":0,"Msg":"","Obj":[{"C":27696.84,"Tick":1679241600,"O":27554.25,"H":28472.00,"L":27124.47,"A":14889767035.22,"V":533099.58},{"C":27549.17,"Tick":1679155200,"O":27227.48,"H":27750.00,"L":26578.00,"A":8588080273.79,"V":316148.14}...]}

History By Last (return Json)

return up to 20 kdatas of lastest
Command
Url:http://map.fxnapi.com:10002/querykm/jsonbylast
Method:GET
Auth:HttpHeader Authorization=AuthCode or AuthCode Trans By QueryString,Reference
Request Args:
nametyperequiredremark
symbolstringyesFull Symbol Cocde Such As BTC,Reference
periodstringyesSupport 1M,3M,5M,10M,15M,30M,1H,2H,4H,D,(W,M Maybe Not)
fromtickslongyesfrom ticks
Request Sample
http://map.fxnapi.com:10002/querykm/jsonbylast?symbol=BTC&period=D&fromticks=0
http://map.fxnapi.com:10002/querykm/jsonbylast?symbol=BTC&period=D&fromticks=0&token=AuthCode
Response:
nametyperemark
Codeintsucc when Code>=0
Msgstringmessage
ObjstringJson Array KData [{"C":close,"Tick":timeticks,"O":open,"H":high,"L":low,"A":amount,"V":volume}...]
Response Sample
{"Code":0,"Msg":"","Obj":[{"C":27696.84,"Tick":1679241600,"O":27554.25,"H":28472.00,"L":27124.47,"A":14889767035.22,"V":533099.58},{"C":27549.17,"Tick":1679155200,"O":27227.48,"H":27750.00,"L":26578.00,"A":8588080273.79,"V":316148.14}...]}

Data Model And Error Code

Model
{"Code":1,"Msg":"","Obj":Any }
nametyperemark
CodestringSuccess when Code >= 0
MsgstringMessage
Objany
Desc
Code >= 0,Succ,Obj is json Obj
Code <0 Fail,Msg is the Fail Message

KData Model

nametyperemark
CdecimalDay Close
TicklongTime Tick
DstringTrading Date(yyyy-MM-dd, output for Day period)
OdecimalDay Open
HdecimalDay High
LdecimalDay Low
AdecimalDay Amount
VdecimalDay Vol

Transfer Of Auth Token

1.AuthCode Trans By QueryString, Code in QueryString is First than the Code in HttpHeader
Such as Testing in Browser http://map.fxnapi.com:10002/queryrm/single?symbol=EURUSD&token=AuthCode
2.AuthCode Trans By Httpheader, key:Authorization, value:Your AuthCode