Installation Guide
Initial proxy server setup and configuration
APISIX Setup
Finmars APISIX Setup Guide
Abstract
As result of that instruction you will have proxy to Exante Broker e.g. https://exante-proxy.client.com where client.com your domain
Prerequisites
Before starting make sure you have the following:
- A machine running Linux with Ubuntu 22.04.
- Docker installed on your machine.
- A public IP address.
- Generated API keys in Exante Account Page
- You need to convert
API Key
andSecret Key
to Basic Auth Token String (Use any public base64 encoder, in other words it should bebase64(api_key + ":" + secret_key)
)
Steps to Set Up APISIX
-
Run the APISIX Docker Container:
docker run -d --name apache-apisix -p 9080:9080 -p 9443:9443 -e APISIX_STAND_ALONE=true apache/apisix
-
Create the
apisix.yaml
Configuration File:Create a file named
apisix.yaml
with your desired configuration. -
Copy the
apisix.yaml
File to the APISIX Container:docker cp apisix.yaml apache-apisix:/var/tmp/
-
Move the
apisix.yaml
File to the APISIX Configuration Directory:docker exec -i apache-apisix sh -c 'cp /var/tmp/apisix.yaml /usr/local/apisix/conf/'
-
Reload the APISIX Configuration:
docker exec -it apache-apisix apisix reload
Setting Up HTTPS
If you want your APISIX instance to listen for HTTPS connections, follow these additional steps:
-
Obtain an SSL Certificate:
Get or create an SSL certificate and export it along with its private key to PEM format.
-
Update
ssls.yaml
:Put the PEM contents into the corresponding sections of
ssls.yaml
. -
Include SSL Configuration in
apisix.yaml
:Add the contents of
ssls.yaml
toapisix.yaml
before the#END
instruction.
apisix:
node_listen: 9080 # HTTP inbound port
ssl:
enable: true
listen:
- port: 9443 # HTTPS inbound port
enable_http3: false
consumers:
- username: finmars # client name
plugins:
basic-auth:
username: foo # inbound credentials, that you will pass to Finmars IT Team
password: bar
# upstream.yaml
upstreams:
- id: 1
nodes:
api-demo.exante.eu:443: 1
scheme: https
pass_host: node
type: roundrobin
- id: 2
nodes:
api-live.exante.eu:443: 1
scheme: https
pass_host: node
type: roundrobin
# plugin_config.yaml
plugin_configs:
- id: 1
plugins:
basic-auth: {}
proxy-rewrite:
headers:
set: # credentials used to connect to api-demo.exante.eu # Basic Auth string from API key and Secret Key
Authorization: "Basic NDQ3YTIxNzEtYWNkMi00N2Q0LWEyOWYtOTk4ZTA5YzQ2Njk0OkJSMUpEQk9NUGdXVmxpN2wyeDBW"
regex_uri:
- "^/demo/(.*)"
- "/$1"
- id: 2
plugins:
basic-auth: {}
proxy-rewrite:
headers:
set: # credentials used to connect to api-live.exante.eu # Basic Auth string from API key and Secret Key
Authorization: "Basic NDQ3YTIxNzEtYWNkMi00N2Q0LWEyOWYtOTk4ZTA5YzQ2Njk0OkJSMUpEQk9NUGdXVmxpN2wyeDBW"
regex_uri:
- "^/live/(.*)"
- "/$1"
# routes.yaml
routes:
- uris:
- /demo/md/*/accounts
- /demo/md/*/symbols/*
- /demo/md/*/summary/*
- /demo/md/*/ohlc/*
- /demo/md/*/transactions
- /demo/trade/*/orders/*
upstream_id: 1
plugin_config_id: 1
- uris:
- /live/md/*/accounts
- /live/md/*/symbols/*
- /live/md/*/summary/*
- /live/md/*/ohlc/*
- /live/md/*/transactions
- /live/trade/*/orders/*
upstream_id: 2
plugin_config_id: 2
#END
Also part if you dont have nginx proxy
# ssls.yaml
ssls:
- id: 1
snis:
- test.com # hostname where apisix instance is running
cert: |
-----BEGIN CERTIFICATE-----
MIICojCCAYoCCQDoby1LjeWcZzANBgkqhkiG9w0BAQsFADARMQ8wDQYDVQQDDAZS
T09UQ0EwIBcNMjQwNzEyMjE1MjEzWhgPMjEyNDA2MTgyMTUyMTNaMBMxETAPBgNV
BAMMCHRlc3QuY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzs5Y
uQvVwF3CFbNlJPk8OO7QlKA8UuapWdSKgT59Vqnkk0/7dfUHfP6pOFG8kxQexZBG
uxbID+nCM175pJyjXjd2mZngtj2E1l3vUHOH6hhE0o5xLAgrDbBxgHnMZHyh/4xz
quXgho0nv1R0i+OcIou4viyDp4BslYBJUONskEihOyUTJaSUS6zR6Q1aABEVEgYi
OF9Wyr2tJ58jTlrRvFgrsDXeOoyf81diA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isxVA==
-----END RSA PRIVATE KEY-----
How To Test
Make a CURL request to APISIX proxy
curl -u foo:bar 0.0.0.0:9080/demo/md/3.0/accounts
or open 0.0.0.0.9080/demo/md/3.0/accounts
in browser and pass Basic Auth Credentials
Get help
- APISIX Documentation [https://apisix.apache.org/docs/apisix/getting-started/README/]
- Exante Documentation [https://api-live.exante.eu/api-docs/]
- Finmars IT Help: s.zhitenev@finmars.com
Vault Setup
Connecting Vault
Currently performed by a Finmars employee at the client's request.
Initializing Vault
Prerequisites
- A created database with an activated license
Actions
- Go to
Settings -> Vault
- Activate Vault and save the secret keys.
Do not lose these keys, as they cannot be recovered. If the keys are lost, the data saved in the Vault will be lost. - Inform the Finmars employee of the Vault token
Unseal Vault
Prerequisites
- A created database with an activated license
- Vault initialized
Actions
- Go to
Settings -> Vault
- Click the Unseal Vault button
- Enter the three keys one by one
Adding Access to Proxy Server
Prerequisites
- A created database with an activated license
- Vault initialized
- Vault unsealed
- Proxy Server deployed
Actions
- Go to
Settings -> Vault
- Click the
Add Engine
button - Enter the name
finmars
- Click the
Add Secret
button - Add the following
json
content:
{
"data_url": "{url_to_proxy_server}/md/3.0/",
"trading_url": "{url_to_proxy_server}/trade/3.0/",
"api_key": "foo",
"secret_key": "bar"
}
-
data_url
- URL to the proxy server's information endpoint specifying the API version - examplehttps://demo-exante.finmars.com/demo/md/3.0/
-
trading_url
- URL to the proxy server's trading endpoint (required for enriching transaction information with orders) specifying the API version - examplehttps://demo-exante.finmars.com/demo/trade/3.0/
-
api_key
,secret_key
- credentials forbasic auth
to the proxy server
- Click the "Save" button
Configuration Installation
Installing Modules
Prerequisites
- A created database with an activated license
Actions
- Go to
Settings -> Configuration -> Marketplace
- Select the
Standard Configuration
package and install it by clicking the install button - Wait for the module installation to complete
- You can check the success of the module installation in the
Data -> Tasks
section. All tasks should be completed. Completion is indicated by a brown rectangle.