文档中心 > API类目 > 业务平台新零售

alibaba.tmi.fx.rate.query (外汇汇率接口)

获取当前汇率

公共参数

请求参数

名称 类型 是否必须 示例值 更多限制 描述
from String 可选 USD USD到
to String 可选 CNY CNY的汇率

响应参数

名称 类型 示例值 描述
common_result CommonResult 接口结果 接口结果
  • └ message
  • String
  • demo
  • message
  • result
  • Result
  • Result
  • Result
  • └ bid_price
  • String
  • 0.2387
  • 买入价
  • └ price_source
  • String
  • Bloomberg Fixing
  • 来源
  • └ mid_price
  • String
  • 0.2388
  • 中间价
  • └ mid_close_price
  • String
  • 0.23875
  • 中间价(收盘价)
  • └ last_update
  • String
  • 1558924200000
  • 数据更新时间
  • └ ask_close_price
  • String
  • 0.2388
  • 卖出价(收盘价)
  • └ bid_close_price
  • String
  • 0.2387
  • 买入价(收盘价)
  • └ currency_pair
  • String
  • MYRUSD BFIX Curncy
  • 货币对
  • └ ask_price
  • String
  • 0.2389
  • 卖出价
  • └ exception
  • String
  • demo
  • demo
  • └ success_flag
  • Boolean
  • true
  • 成功标识

请求示例

  • JAVA
  • .NET
  • PHP
  • CURL
  • Python
  • C/C++
  • NodeJS
TaobaoClient client = new DefaultTaobaoClient(url, appkey, secret);
AlibabaTmiFxRateQueryRequest req = new AlibabaTmiFxRateQueryRequest();
req.setFrom("USD");
req.setTo("CNY");
AlibabaTmiFxRateQueryResponse rsp = client.execute(req);
System.out.println(rsp.getBody());

响应示例

  • XML示例
  • JSON示例
<alibaba_tmi_fx_rate_query_response>
    <common_result>
        <message>demo</message>
        <result>
            <bid_price>0.2387</bid_price>
            <price_source>Bloomberg Fixing</price_source>
            <mid_price>0.2388</mid_price>
            <mid_close_price>0.23875</mid_close_price>
            <last_update>1558924200000</last_update>
            <ask_close_price>0.2388</ask_close_price>
            <bid_close_price>0.2387</bid_close_price>
            <currency_pair>MYRUSD BFIX Curncy</currency_pair>
            <ask_price>0.2389</ask_price>
        </result>
        <exception>demo</exception>
        <success_flag>true</success_flag>
    </common_result>
</alibaba_tmi_fx_rate_query_response>

异常示例

  • XML示例
  • JSON示例
<error_response>
    <code>50</code>
    <msg>Remote service error</msg>
    <sub_code>isv.invalid-parameter</sub_code>
    <sub_msg>非法参数</sub_msg>
</error_response>

错误码解释

错误码 错误描述 解决方案

API工具

如何获得此API

FAQ

返回
顶部