{"_id":"596283734f803e001527c632","project":"55312174c68f493900aebb3f","version":{"_id":"55312174c68f493900aebb42","project":"55312174c68f493900aebb3f","__v":10,"createdAt":"2015-04-17T15:06:28.598Z","releaseDate":"2015-04-17T15:06:28.598Z","categories":["55312175c68f493900aebb43","566b431d03b4b20d00d02c3a","566b58f212bc0517005d3068","566b59110506f40d0034f148","566b7cc94d1a4d0d00801c00","566b82d130cdb417008d217d","566b855b4d1a4d0d00801c04","566b856f03870a0d008ee7a7","566c42d2f0a5dc0d009acbab","566c443d85dc790d0062c134"],"is_deprecated":false,"is_hidden":false,"is_beta":false,"is_stable":true,"codename":"","version_clean":"0.7.0","version":"0.7"},"category":{"_id":"566b59110506f40d0034f148","__v":5,"pages":["566b5afcec4a320d00a8ca76","566b63213d25d00d0066b00a","56a47942e5e9190d00ad6200","56a480315fb2530d00421b75","56a489ae9093960d00f9ab31"],"project":"55312174c68f493900aebb3f","version":"55312174c68f493900aebb42","sync":{"url":"","isSync":false},"reference":true,"createdAt":"2015-12-11T23:15:29.864Z","from_sync":false,"order":2,"slug":"extra-parameters","title":"Extra Parameters"},"user":"5531215e29603d2300011341","__v":0,"parentDoc":null,"updates":[],"next":{"pages":[],"description":""},"createdAt":"2017-07-09T19:26:43.197Z","link_external":false,"link_url":"","githubsync":"","sync_unique":"","hidden":false,"api":{"settings":"","results":{"codes":[]},"examples":{"codes":[]},"auth":"required","params":[{"_id":"566b5afcec4a320d00a8ca77","ref":"","in":"body","required":false,"desc":"","default":"USD","type":"string","name":"base"},{"_id":"566cabbef0a5dc0d009acbc6","ref":"","in":"body","required":false,"desc":"","default":"","type":"string","name":"app_id"}],"url":"/latest.json"},"isReference":true,"order":2,"body":"[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Request 'Bid-Ask' Rates\"\n}\n[/block]\nAppend the `show_bid_ask` query parameter to your `latest.json`, `historical/` or `spot.json` API request, like so:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"https://openexchangerates.org/api/latest.json\\n    ?app_id=YOUR_APP_ID\\n    &show_bid_ask=1\",\n      \"language\": \"http\"\n    },\n    {\n      \"code\": \"$.get('https://openexchangerates.org/api/latest.json', {app_id: 'YOUR_APP_ID', show_alternative: 1}, function(data) {\\n    console.log(data);\\n});\",\n      \"language\": \"javascript\",\n      \"name\": \"jQuery\"\n    }\n  ]\n}\n[/block]\nThe response format is the same as the standard API response, except that instead of a single (midpoint) value for each returned currency symbol, you will now receive an object containing `bid`, `ask` and `mid` for each currency where these are available*:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"{\\n  \\\"disclaimer\\\": \\\"...\\\",\\n  \\\"license\\\": \\\"...\\\",\\n  \\\"timestamp\\\": 1501084644,\\n  \\\"base\\\": \\\"USD\\\",\\n  \\\"rates\\\": {\\n    \\\"AED\\\": {\\n      \\\"bid\\\": 3.67229,\\n      \\\"ask\\\": 3.67378,\\n      \\\"mid\\\": 3.673035\\n    },\\n    \\\"AFN\\\": {\\n      \\\"bid\\\": 68.399726,\\n      \\\"ask\\\": 68.690659,\\n      \\\"mid\\\": 68.545193\\n    },\\n    /* ... */\\n}\",\n      \"language\": \"json\"\n    }\n  ]\n}\n[/block]\n*For some currencies, we do not currently provide bid and ask prices. In such cases, or if we don't have `bid` and `ask` prices available for a given currency or data, we will not return them for that symbol.\n\nYou will still receive `mid`, but `bid` and `ask` will not be included.\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Basic Code Samples\"\n}\n[/block]\n\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"$.get('https://openexchangerates.org/api/latest.json', {app_id: 'YOUR_APP_ID', show_bid_ank: 1}, function(data) {\\n    console.log(\\\"USD/GBP 'bid' price: \\\" + data.rates.GBP.bid);\\n    console.log(\\\"USD/GBP 'ask' price: \\\" + data.rates.GBP.ask);\\n});\",\n      \"language\": \"javascript\",\n      \"name\": \"jQuery\"\n    },\n    {\n      \"code\": \"More code samples are on their way! Please get in touch if you'd like to submit a new/improved code sample in your languague or framework.\",\n      \"language\": \"text\",\n      \"name\": \"Others...\"\n    }\n  ]\n}\n[/block]\n\n[block:api-header]\n{\n  \"type\": \"basic\",\n  \"title\": \"Combining Parameters\"\n}\n[/block]\nThe `show_bid_ask` parameter can be combined with any other parameters available, such as `base` and `symbols`, and historical queries.","excerpt":"Request bid, ask and mid prices for all currencies, where available. \n\nWe calculate the best available (top of the book) buy and sell prices for the majority of currencies we offer, and provide these instead of a single midpoint rate when you use the `show_bid_ask` API parameter. \n\nUsing this parameter replaces the regular results, so that instead of a midpoint currency value for each returned currency symbol, you will receive an object containing `ask`, `bid`, and `mid`.\n\nCurrently available for clients of our VIP Platinum tier. Please contact us if you would like to test out this feature.","slug":"bid-ask-prices","type":"basic","title":"Bid-Ask Prices ('show_bid_ask')"}

Bid-Ask Prices ('show_bid_ask')

Request bid, ask and mid prices for all currencies, where available. We calculate the best available (top of the book) buy and sell prices for the majority of currencies we offer, and provide these instead of a single midpoint rate when you use the `show_bid_ask` API parameter. Using this parameter replaces the regular results, so that instead of a midpoint currency value for each returned currency symbol, you will receive an object containing `ask`, `bid`, and `mid`. Currently available for clients of our VIP Platinum tier. Please contact us if you would like to test out this feature.

[block:api-header] { "type": "basic", "title": "Request 'Bid-Ask' Rates" } [/block] Append the `show_bid_ask` query parameter to your `latest.json`, `historical/` or `spot.json` API request, like so: [block:code] { "codes": [ { "code": "https://openexchangerates.org/api/latest.json\n ?app_id=YOUR_APP_ID\n &show_bid_ask=1", "language": "http" }, { "code": "$.get('https://openexchangerates.org/api/latest.json', {app_id: 'YOUR_APP_ID', show_alternative: 1}, function(data) {\n console.log(data);\n});", "language": "javascript", "name": "jQuery" } ] } [/block] The response format is the same as the standard API response, except that instead of a single (midpoint) value for each returned currency symbol, you will now receive an object containing `bid`, `ask` and `mid` for each currency where these are available*: [block:code] { "codes": [ { "code": "{\n \"disclaimer\": \"...\",\n \"license\": \"...\",\n \"timestamp\": 1501084644,\n \"base\": \"USD\",\n \"rates\": {\n \"AED\": {\n \"bid\": 3.67229,\n \"ask\": 3.67378,\n \"mid\": 3.673035\n },\n \"AFN\": {\n \"bid\": 68.399726,\n \"ask\": 68.690659,\n \"mid\": 68.545193\n },\n /* ... */\n}", "language": "json" } ] } [/block] *For some currencies, we do not currently provide bid and ask prices. In such cases, or if we don't have `bid` and `ask` prices available for a given currency or data, we will not return them for that symbol. You will still receive `mid`, but `bid` and `ask` will not be included. [block:api-header] { "type": "basic", "title": "Basic Code Samples" } [/block] [block:code] { "codes": [ { "code": "$.get('https://openexchangerates.org/api/latest.json', {app_id: 'YOUR_APP_ID', show_bid_ank: 1}, function(data) {\n console.log(\"USD/GBP 'bid' price: \" + data.rates.GBP.bid);\n console.log(\"USD/GBP 'ask' price: \" + data.rates.GBP.ask);\n});", "language": "javascript", "name": "jQuery" }, { "code": "More code samples are on their way! Please get in touch if you'd like to submit a new/improved code sample in your languague or framework.", "language": "text", "name": "Others..." } ] } [/block] [block:api-header] { "type": "basic", "title": "Combining Parameters" } [/block] The `show_bid_ask` parameter can be combined with any other parameters available, such as `base` and `symbols`, and historical queries.