|
| 1 | +############ Historic Forex Ticks #################### |
| 2 | +function historic_forex_ticks(opts::PolyOpts, from="AUD", to="USD", date="2020-10-14"; limit=100, kwargs...) |
| 3 | + params = Dict( |
| 4 | + "apiKey" => opts.api_key, |
| 5 | + "limit" => limit |
| 6 | + ) |
| 7 | + |
| 8 | + merge!(params, Dict(kwargs)) |
| 9 | + |
| 10 | + historic_forex_ticks_url = "$historic_forex_ticks_base_url/$from/$to/$date" |
| 11 | + return generate_output_from_url(YesSinkYesTicks(), historic_forex_ticks_url, params, opts.sink) |
| 12 | +end |
| 13 | + |
| 14 | + |
| 15 | +############ Real Time Currency Conversion #################### |
| 16 | +function real_time_currency_conversion(opts::PolyOpts, from="AUD", to="USD"; amount=100, precision=2) |
| 17 | + params = Dict( |
| 18 | + "apiKey" => opts.api_key, |
| 19 | + "amount" => amount, |
| 20 | + "precision" => precision |
| 21 | + ) |
| 22 | + real_time_currency_conversion_url = "$real_time_currency_conversion_base_url/$from/$to" |
| 23 | + return generate_output_from_url(YesSinkNoResults(), real_time_currency_conversion_url, params, opts.sink) |
| 24 | +end |
| 25 | + |
| 26 | + |
| 27 | +############ Last Quote Currency Pair #################### |
| 28 | +function last_quote_currency_pair(opts::PolyOpts, from="AUD", to="USD") |
| 29 | + params = Dict( |
| 30 | + "apiKey" => opts.api_key |
| 31 | + ) |
| 32 | + last_quote_currency_pair_url = "$last_quote_currency_pair_base_url/$from/$to" |
| 33 | + return generate_output_from_url(YesSinkNoResults(), last_quote_currency_pair_url, params, opts.sink) |
| 34 | +end |
| 35 | + |
| 36 | + |
| 37 | +############ Forex Grouped Daily Bars #################### |
| 38 | +function forex_grouped_daily_bars(opts::PolyOpts, date="2020-10-14"; adjusted=true) |
| 39 | + params = Dict( |
| 40 | + "apiKey" => opts.api_key, |
| 41 | + "adjusted" => adjusted |
| 42 | + ) |
| 43 | + forex_grouped_daily_bars_url = "$forex_grouped_daily_bars_base_url/$date" |
| 44 | + return generate_output_from_url(YesSinkYesResults(), forex_grouped_daily_bars_url, params, opts.sink) |
| 45 | +end |
| 46 | + |
| 47 | + |
| 48 | +############ Forex Previous Close #################### |
| 49 | +function forex_previous_close(opts::PolyOpts, forexTicker="C:EURUSD"; adjusted=true) |
| 50 | + params = Dict( |
| 51 | + "apiKey" => opts.api_key, |
| 52 | + "adjusted" => adjusted |
| 53 | + ) |
| 54 | + forex_previous_close_url = "$forex_previous_close_base_url/$forexTicker/prev" |
| 55 | + return generate_output_from_url(YesSinkYesResults(), forex_previous_close_url, params, opts.sink) |
| 56 | +end |
| 57 | + |
| 58 | + |
| 59 | +############ Forex Aggregates Bars #################### |
| 60 | +function forex_aggregates_bars(opts::PolyOpts, |
| 61 | + forexTicker="C:EURUSD", |
| 62 | + multiplier=1, |
| 63 | + timespan="day", |
| 64 | + from="2020-10-14", |
| 65 | + to="2020-10-14"; |
| 66 | + adjusted=true, |
| 67 | + sort="asc", |
| 68 | + limit=120) |
| 69 | + params = Dict( |
| 70 | + "apiKey" => opts.api_key, |
| 71 | + "adjusted" => adjusted, |
| 72 | + "sort" => sort, |
| 73 | + "limit" => limit |
| 74 | + ) |
| 75 | + |
| 76 | + forex_aggregates_bars_url = "$forex_aggregates_bars_base_url/$forexTicker/range/$multiplier/$timespan/$from/$to" |
| 77 | + return generate_output_from_url(YesSinkYesResults(), forex_aggregates_bars_url, params, opts.sink) |
| 78 | +end |
| 79 | + |
| 80 | + |
| 81 | +############ Forex Snapshot Ticker #################### |
| 82 | +function forex_snapshot_ticker(opts::PolyOpts, forexTicker="C:EURUSD") |
| 83 | + params = Dict( |
| 84 | + "apiKey" => opts.api_key |
| 85 | + ) |
| 86 | + forex_snapshot_ticker_url = "$forex_snapshot_ticker_base_url/$forexTicker" |
| 87 | + return generate_output_from_url(YesSinkYesTicker(), forex_snapshot_ticker_url, params, opts.sink) |
| 88 | +end |
| 89 | + |
| 90 | + |
| 91 | +############ Forex Snapshot All Tickers #################### |
| 92 | +function forex_snapshot_all_tickers(opts::PolyOpts; kwargs...) |
| 93 | + params = Dict( |
| 94 | + "apiKey" => opts.api_key |
| 95 | + ) |
| 96 | + merge!(params, Dict(kwargs)) |
| 97 | + forex_snapshot_all_tickers_url = "$forex_snapshot_all_tickers_base_url" |
| 98 | + return generate_output_from_url(YesSinkYesTickers(), forex_snapshot_all_tickers_url, params, opts.sink) |
| 99 | +end |
| 100 | + |
| 101 | + |
| 102 | +############ Forex Snapshot Gainers/Losers #################### |
| 103 | +function forex_snapshot_gainers_losers(opts::PolyOpts, direction="gainers") |
| 104 | + params = Dict( |
| 105 | + "apiKey" => opts.api_key |
| 106 | + ) |
| 107 | + forex_snapshot_gainers_losers_url = "$forex_snapshot_gainers_losers_base_url/$direction" |
| 108 | + return generate_output_from_url(YesSinkYesTickers(), forex_snapshot_gainers_losers_url, params, opts.sink) |
| 109 | +end |
0 commit comments