← Underrättelsekombinationer

Commodity-Currency Correlation

GET /mashup/commodity/currency

Analyze how commodity prices relate to currency movements: combines commodity spot prices with forex rates and 30-day volatility for multiple currencies.

Parametrar

commodity valfri

Commodity name (default gold)

valutor valfri

Comma-separated currency codes (default USD,EUR,GBP,NOK)

Exempelförfrågningar

Grundläggande användning
curl "https://nordapi.ee/api/v1/mashup/commodity/currency?commodity=gold&currencies=USD,EUR,NOK"

Livesvar

HTTP 500: "# Protocol.UndefinedError at GET /api/v1/mashup/commodity/currency\n\nException:\n\n    ** (Protocol.UndefinedError) protocol Jason.Encoder not implemented for App.Commodities.CommodityPrice (a struct), Jason.Encoder protocol must always be explicitly implemented.\n    \n    If you own the struct, you can derive the implementation specifying which fields should be encoded to JSON:\n    \n        @derive {Jason.Encoder, only: [....]}\n        defstruct ...\n    \n    It is also possible to encode all fields, although this should be used carefully to avoid accidentally leaking private information when new fields are added:\n    \n        @derive Jason.Encoder\n        defstruct ...\n    \n    Finally, if you don't own the struct you want to encode to JSON, you may use Protocol.derive/3 placed outside of any module:\n    \n        Protocol.derive(Jason.Encoder, NameOfTheStruct, only: [...])\n        Protocol.derive(Jason.Encoder, NameOfTheStruct)\n    . This protocol is implemented for: Any, Atom, BitString, Date, DateTime, Decimal, Ecto.Association.NotLoaded, Ecto.Schema.Metadata, Float, Integer, Jason.Fragment, Jason.OrderedObject, List, Map, NaiveDateTime, Time\n    \n    Got value:\n    \n        %App.Commodities.CommodityPrice{\n          __meta__: #Ecto.Schema.Metadata<:loaded, \"commodity_prices\">,\n          id: \"f328f750-3292-4210-bde8-a7f79dab82ec\",\n          commodity: \"gold\",\n          name: \"Gold (Troy Ounce)\",\n          price_usd: Decimal.new(\"3045.0000\"),\n          unit: \"troy_oz\",\n          date: ~D[2026-03-20],\n          source: \"reference\",\n          inserted_at: ~U[2026-03-20 22:04:11Z],\n          updated_at: ~U[2026-03-20 22:04:11Z]\n        }\n    \n        (jason 1.4.4) lib/jason.ex:213: Jason.encode_to_iodata!/2\n        (phoenix 1.8.5) lib/phoenix/controller.ex:364: Phoenix.Controller.json/2\n        (app 0.1.0) lib/app_web/controllers/api/v1/mashup_controller.ex:1: AppWeb.API.V1.MashupController.action/2\n        (app 0.1.0) lib/app_web/controllers/api/v1/mashup_controller.ex:1: AppWeb.API.V1.MashupController.phoenix_controller_pipeline/2\n        (phoenix 1.8.5) lib/phoenix/router.ex:416: Phoenix.Router.__call__/5\n        (app 0.1.0) lib/app_web/endpoint.ex:1: AppWeb.Endpoint.plug_builder_call/2\n        (app 0.1.0) deps/plug/lib/plug/debugger.ex:155: AppWeb.Endpoint.\"call (overridable 3)\"/2\n        (app 0.1.0) lib/app_web/endpoint.ex:1: AppWeb.Endpoint.call/2\n        (phoenix 1.8.5) lib/phoenix/endpoint/sync_code_reload_plug.ex:22: Phoenix.Endpoint.SyncCodeReloadPlug.do_call/4\n        (bandit 1.10.3) lib/bandit/pipeline.ex:131: Bandit.Pipeline.call_plug!/2\n        (bandit 1.10.3) lib/bandit/pipeline.ex:42: Bandit.Pipeline.run/5\n        (bandit 1.10.3) lib/bandit/http1/handler.ex:13: Bandit.HTTP1.Handler.handle_data/3\n        (bandit 1.10.3) lib/bandit/delegating_handler.ex:18: Bandit.DelegatingHandler.handle_data/3\n        (bandit 1.10.3) lib/bandit/delegating_handler.ex:8: Bandit.DelegatingHandler.handle_info/2\n        (stdlib 7.1) gen_server.erl:2434: :gen_server.try_handle_info/3\n        (stdlib 7.1) gen_server.erl:2420: :gen_server.handle_msg/3\n        (stdlib 7.1) proc_lib.erl:333: :proc_lib.init_p_do_apply/3\n    \n\n## Connection details\n\n### Params\n\n    %{\"commodity\" => \"gold\", \"currencies\" => \"USD,EUR,NOK\"}\n\n### Request info\n\n  * URI: http://localhost:4000/api/v1/mashup/commodity/currency\n  * Query string: commodity=gold&currencies=USD,EUR,NOK\n\n### Headers\n  \n  * accept-encoding: gzip\n  * host: localhost:4000\n  * user-agent: req/0.5.17\n\n### Session\n\n    %{}\n"