repo_id
stringclasses
137 values
file_path
stringlengths
10
89
content
stringlengths
0
990k
__index_level_0__
int64
0
0
dashboards
/mono/infra/services/grafana/provisioning/dashboards/simple_market_maker_dot_usd.json
{ "annotations": { "list": [ { "builtIn": 1, "datasource": { "type": "grafana", "uid": "-- Grafana --" }, "enable": true, "hide": true, "iconColor": "rgba(0, 211, 255, 1)", "name": "Annotations & Alerts", "target": { ...
0
datasources
/mono/infra/services/grafana/provisioning/datasources/datasources.yml
apiVersion: 1 datasources: - name: Prometheus type: prometheus access: proxy orgId: 1 url: http://prometheus:9090 basicAuth: false isDefault: true editable: true uid: prometheus version: 1 jsonData: httpMethod: GET - name: Tempo type: tempo access: proxy or...
0
prometheus
/mono/infra/services/prometheus/prometheus.yml
global: scrape_interval: 5s scrape_configs: - job_name: "proxy-kraken-docker" static_configs: - targets: ["proxy-kraken:3001"] - job_name: "proxy-kraken" static_configs: - targets: ["host.docker.internal:3001"] - job_name: "proxy-poloniex" static_configs: - targets: ["proxy-polonie...
0
prometheus
/mono/infra/services/prometheus/prometheus.dev.yml
global: scrape_interval: 30s scrape_configs: - job_name: node scrape_interval: 60s metrics_path: /metrics static_configs: - targets: - host.docker.internal:9100 - job_name: redpanda metrics_path: /public_metrics static_configs: - targets: - redpanda:9644 - ...
0
prometheus
/mono/infra/services/prometheus/README.md
# Prometheus Prometheus is used to scrape metrics from our services and expose them to tools like Grafana for visualization. This doc will eventually give an overview of our Prometheus architecture and useful commands for managing Prom. [[__TOC__]] ## Management ### Live reloading config You can live reload Promet...
0
scripts
/mono/scripts/create-gitlab-registry-secret.sh
#!/usr/bin/env bash # This script uses Gitlab's SSH API to automatically generate image pull credentials for Kubernetes # https://docs.gitlab.com/ee/development/gitlab_shell/features.html gl_welcome_msg=$(ssh git@gitlab.com) # Welcome to GitLab, @ddaws! gl_pat_token_name="k8s-$(kubectl config current-context)-read-r...
0
scripts
/mono/scripts/wsl-kernel.sh
#!/bin/bash docker build -f docker/wsl/Dockerfile -t fdr-wsl-kernel-builder:latest ./docker/wsl mkdir -p .kernel && docker run -it -v $PWD/.kernel:/kernel/src fdr-wsl-kernel-builder /kernel/build.sh cp .kernel/WSL2-Linux-Kernel/arch/x86/boot/vmlinux.bin /mnt/c/Users/All\ Users
0
scripts
/mono/scripts/helm-dep-build.sh
#!/bin/bash GIT_ROOT="$(git rev-parse --show-toplevel)" for dir in $GIT_ROOT/helm/*; do if [[ ! -f "${dir}"/Chart.yaml ]] || [[ ! -f "${dir}"/Chart.lock ]]; then continue fi echo "========================================" echo "Updating: ${dir}" echo "========================================" cd $di...
0
scripts
/mono/scripts/docker-build-for-k8s.sh
#!/bin/bash # This script is used to build the docker image for the k8s cluster # by detecting the OS and kubernetes context (e.g: minikube vs docker-desktop) # and building the image accordingly # Usage: ./scripts/docker-build-for-k8s.sh -o # Usage: ./scripts/docker-build-for-k8s.sh -p -b <binary_name> # This is neces...
0
scripts
/mono/scripts/helm-clean.sh
#/usr/bin/env bash # Remove all of the old fdr-common chart bundles find helm/ -type f -name "fdr-common-*.tgz" -exec rm {} \;
0
scripts
/mono/scripts/tilt-clean-up.sh
#!/bin/env bash # This script cleans up resources that are left behind by Tilt after running # `tilt down`. This can occur when the Tiltfile is updated from using # `k8s_yaml(helm(...))` to using `helm_resource(...)` because the resources # created are tracked differently. if curl -s http://localhost:10350 > /dev/...
0
sql
/mono/scripts/sql/create-role-archive-service.sql
-- See README.md in this directory for instructions on how to use this scripts DO $$ DECLARE v_username VARCHAR := current_setting('myvars.username'); v_password VARCHAR := current_setting('myvars.password'); BEGIN -- TODO: Add a check that the user doesn't already exist EXECUTE format('CREATE ROLE %I ...
0
sql
/mono/scripts/sql/create-role-vault.sql
-- See README.md in this directory for instructions on how to use this scripts DO $$ DECLARE v_username VARCHAR := current_setting('myvars.username'); v_password VARCHAR := current_setting('myvars.password'); BEGIN -- TODO: Add a check that the user doesn't already exist EXECUTE format('CREATE ROLE %I ...
0
sql
/mono/scripts/sql/create-role-strat-tri-arb.sql
-- See README.md in this directory for instructions on how to use this scripts DO $$ DECLARE v_username VARCHAR := current_setting('myvars.username'); v_password VARCHAR := current_setting('myvars.password'); BEGIN -- TODO: Add a check that the user doesn't already exist EXECUTE format('CREATE ROLE %I ...
0
sql
/mono/scripts/sql/README.md
# SQL Scripts These scripts are used to manage our database. As much as possible we try to automate database management, but in some cases we are not ready for automation and need to do things manually. When we need to do things manually we try to version control the things we need to do. ## Creating users (aka rol...
0
sql
/mono/scripts/sql/dump.sql
-- -- PostgreSQL database dump -- -- Dumped from database version 15.4 -- Dumped by pg_dump version 16.1 SET statement_timeout = 0; SET lock_timeout = 0; SET idle_in_transaction_session_timeout = 0; SET client_encoding = 'UTF8'; SET standard_conforming_strings = on; SELECT pg_catalog.set_config('search_path', '', fal...
0
sql
/mono/scripts/sql/create-role-grafana.sql
-- See README.md in this directory for instructions on how to use this scripts DO $$ DECLARE v_username VARCHAR := current_setting('myvars.username'); v_password VARCHAR := current_setting('myvars.password'); rec record; BEGIN -- TODO: Add a check that the user doesn't already exist EXECUTE format(...
0
tilt
/mono/scripts/tilt/docker_build.py
def fdr_docker_build( name, context, dockerfile, build_args={}, extra_tags=[], target=None, ): cmd = 'docker buildx build {context} -f {dockerfile} {build_args} {extra_tags}'.format( context=context, dockerfile=dockerfile, build_args=' '.join(['--build-arg {}={}'.for...
0
tilt
/mono/scripts/tilt/port_forward.sh
#!/usr/bin/env bash count=0 limit=6 sleep=10 until [ "$count" -ge "$limit" ]; do count=$((count+1)) kubectl port-forward $1 $2:$3 & if [ $? -eq 0 ]; then echo "Forwarding $1 $2:$3" wait fi [ "$count" -ge "$limit" ] && break echo "Failed to create port forward. The service m...
0
tilt
/mono/scripts/tilt/port_forward.py
def fdr_port_forward(resource, local_port, container_port, name=None, labels=[]): ''' A more reliable port forward, using Kubernetes native port forwarding. ''' name = name or 'pf:{}'.format(resource.split("/")[1]) cmd = '{}/scripts/tilt/port_forward.sh {} {} {}'.format( os.getcwd(), ...
0
.sqlx
/mono/.sqlx/query-0b73f42af6d7adc427fd195e3ec72c05c309c2d9ffec95d85d25a577ca515584.json
{ "db_name": "PostgreSQL", "query": "\n SELECT\n vba.id AS \"id: _\",\n vba.account_id AS \"account_id: _\",\n vba.account_status AS \"account_status: _\",\n vba.asset AS \"asset: _\",\n vba.amount AS \"amount: _\",\n ...
0
.sqlx
/mono/.sqlx/query-3b1362459dfd1917387a2d30f517fc47b869bca502e4c461f9f9754357c597a2.json
{ "db_name": "PostgreSQL", "query": "\n INSERT INTO virtual_balance_accounts (id, account_id, account_status, asset, amount, created_at)\n VALUES ($1, $2, $3, $4, $5, $6)\n ON CONFLICT (id) DO NOTHING\n ", "describe": { "columns": [], "parameters": { "Left...
0
.sqlx
/mono/.sqlx/query-fecf3a43a6e6ccc148e0272a36fddfea720c1ddbf8a3202264b596521015b9bb.json
{ "db_name": "PostgreSQL", "query": "\n INSERT INTO orders (id, strategy, exchange, order_type, base, quote, order_side, price, volume, expire_time, strat_run_id, created_at)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12)\n ON CONFLICT (id) DO NOTHING\n ", ...
0
.sqlx
/mono/.sqlx/query-40d1d766a3f7840d21aa8855eeae4327b09f2582732489bc08dccfebc95aed6a.json
{ "db_name": "PostgreSQL", "query": "DELETE FROM balance_metrics WHERE run_id = $1", "describe": { "columns": [], "parameters": { "Left": [ "Uuid" ] }, "nullable": [] }, "hash": "40d1d766a3f7840d21aa8855eeae4327b09f2582732489bc08dccfebc95aed6a" }
0
.sqlx
/mono/.sqlx/query-be3c52c57c3d1c4c8954cb8fd4451e16fb6ae4a027ef9a036323bc98c4177b79.json
{ "db_name": "PostgreSQL", "query": "\n INSERT INTO opportunities_orders (opportunity_id, order_id)\n VALUES ($1, $2)\n ON CONFLICT (opportunity_id, order_id) DO NOTHING\n ", "describe": { "columns": [], "parameters": { "Left": [ "Uuid", "U...
0
.sqlx
/mono/.sqlx/query-4f52e417fd5a1dc9954ca653c15199a85b1f7d3886b35c650b12853f40117384.json
{ "db_name": "PostgreSQL", "query": "\n INSERT INTO strategies (id, name)\n VALUES ($1, $2)\n ON CONFLICT (id) DO NOTHING\n ", "describe": { "columns": [], "parameters": { "Left": [ "Uuid", { "Custom": { "n...
0
.sqlx
/mono/.sqlx/query-3239b942a855174275329017c27008231bd055a5a7708fec97326d30a0f061c1.json
{ "db_name": "PostgreSQL", "query": "\n INSERT INTO strat_runs (id, strat_id, name)\n VALUES ($1, $2, $3)\n ON CONFLICT (id) DO NOTHING\n ", "describe": { "columns": [], "parameters": { "Left": [ "Uuid", "Uuid", "Text" ] }, ...
0
.sqlx
/mono/.sqlx/query-8561a660ec592e77fa0f7fedb85237b67c7f5ec2625b503d39a5578202580c99.json
{ "db_name": "PostgreSQL", "query": "DELETE FROM strat_balance_accounts WHERE strat_run_id = $1", "describe": { "columns": [], "parameters": { "Left": [ "Uuid" ] }, "nullable": [] }, "hash": "8561a660ec592e77fa0f7fedb85237b67c7f5ec2625b503d39a5578202580c99" }
0
.sqlx
/mono/.sqlx/query-07a65bb2ca2d259bf85652b3e3745a883b181647195e0c4a971ba19f0c124f7b.json
{ "db_name": "PostgreSQL", "query": "DELETE FROM virtual_balance_accounts WHERE id = ANY($1)", "describe": { "columns": [], "parameters": { "Left": [ "UuidArray" ] }, "nullable": [] }, "hash": "07a65bb2ca2d259bf85652b3e3745a883b181647195e0c4a971ba19f0c124f7b" }
0
.sqlx
/mono/.sqlx/query-ebdda01f9c9e26c135af6123a2f49643fe931733176f87dd5abc098f17609cfd.json
{ "db_name": "PostgreSQL", "query": "\n SELECT\n vba.id AS \"id: _\",\n vba.account_id AS \"account_id: _\",\n vba.account_status AS \"account_status: _\",\n vba.asset AS \"asset: _\",\n vba.amount AS \"amount: _\",\n ...
0
.sqlx
/mono/.sqlx/query-eab7fb92251e25637a9f87c5d328c2ac685992281c010e59d378f631c73e62d3.json
{ "db_name": "PostgreSQL", "query": "\n INSERT INTO trades (id, exchange, trade_ref, pos_trade_ref, order_ref, base, quote, time, order_side, order_type, price, cost, fee, volume, margin, user_ref, extra_fields, strat_run_id)\n VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $1...
0
.sqlx
/mono/.sqlx/query-4c95265755ef6f87a47402653fe66245aad89455ce34dcae644a8f07078391de.json
{ "db_name": "PostgreSQL", "query": "\n INSERT INTO archive (timestamp, archive_type, exchange, base, quote, last_price, data)\n VALUES ($1, $2, $3, $4, $5, $6, $7)\n ", "describe": { "columns": [], "parameters": { "Left": [ "Timestamptz", { "Cu...
0
.sqlx
/mono/.sqlx/query-4b0f6ff375bdbc69ffec505a48f98bd9337e0c9e00559aaa08350840dd743463.json
{ "db_name": "PostgreSQL", "query": "\n INSERT INTO opportunities (id, run_id)\n VALUES ($1, $2)\n ON CONFLICT (id) DO NOTHING\n ", "describe": { "columns": [], "parameters": { "Left": [ "Uuid", "Uuid" ] }, "nullable": [] },...
0
.sqlx
/mono/.sqlx/query-c7c965a6c9f6b30041c9d008befceccab76fef5398415572f78cfa4edeaf9a84.json
{ "db_name": "PostgreSQL", "query": "\n INSERT INTO virtual_balance_accounts (id, account_id, account_status, asset, amount, created_at)\n VALUES ($1, $2, $3, $4, $5, $6)\n ON CONFLICT (id) DO NOTHING\n ", "describe": { "columns": [], "parameters": { "Left": [...
0
.sqlx
/mono/.sqlx/query-e8f0bfefb70b1b004df0789bffd6e01b3ca15c1a2a05232f9af31306c3078c9e.json
{ "db_name": "PostgreSQL", "query": "\n INSERT INTO balance_accounts (id, asset, amount)\n VALUES ($1, $2, $3)\n ON CONFLICT (id) DO NOTHING\n ", "describe": { "columns": [], "parameters": { "Left": [ "Uuid", { "Custom": { ...
0
.sqlx
/mono/.sqlx/query-43a3918c44f5faab9ccbe58e229c76f6c706db511b6d449aa3c7545a3a6bc07a.json
{ "db_name": "PostgreSQL", "query": "\n UPDATE orders\n SET volume_filled = volume_filled + $1,\n total_cost = COALESCE(total_cost, 0) + $2\n WHERE id = $3\n ", "describe": { "columns": [], "parameters": { "Left": [ "Numeric", ...
0
.sqlx
/mono/.sqlx/query-def55a32f6cab3a6c0ee4bd8c8ff0031eb916945e2c7eeeaa37ee6a652fb2efc.json
{ "db_name": "PostgreSQL", "query": "DELETE FROM orders WHERE strat_run_id = $1", "describe": { "columns": [], "parameters": { "Left": [ "Uuid" ] }, "nullable": [] }, "hash": "def55a32f6cab3a6c0ee4bd8c8ff0031eb916945e2c7eeeaa37ee6a652fb2efc" }
0
.sqlx
/mono/.sqlx/query-5275cda6ec6a246087eb45130d252f25469edd929d31829e4636224d182e1c73.json
{ "db_name": "PostgreSQL", "query": "DELETE FROM vba_balance_ledgers WHERE vba_id = ANY($1)", "describe": { "columns": [], "parameters": { "Left": [ "UuidArray" ] }, "nullable": [] }, "hash": "5275cda6ec6a246087eb45130d252f25469edd929d31829e4636224d182e1c73" }
0
.sqlx
/mono/.sqlx/query-df64f7b325ef6cfb62115a9fd1ed139e60254f895e2af58e792c0eb96f02e9d5.json
{ "db_name": "PostgreSQL", "query": "SELECT strat_id FROM strat_runs WHERE id = $1", "describe": { "columns": [ { "ordinal": 0, "name": "strat_id", "type_info": "Uuid" } ], "parameters": { "Left": [ "Uuid" ] }, "nullable": [ false ...
0
.sqlx
/mono/.sqlx/query-ab449cd0a3430661c6c843a960412fdafd2aab94b3d96a3256d6779a42300001.json
{ "db_name": "PostgreSQL", "query": "SELECT vba_id FROM strat_balance_accounts WHERE strat_run_id = $1", "describe": { "columns": [ { "ordinal": 0, "name": "vba_id", "type_info": "Uuid" } ], "parameters": { "Left": [ "Uuid" ] }, "nullable...
0
.sqlx
/mono/.sqlx/query-9366095a4805111b455d1f28f179acaacae49621454ccfab34ebff80da5af868.json
{ "db_name": "PostgreSQL", "query": "DELETE FROM trades WHERE strat_run_id = $1", "describe": { "columns": [], "parameters": { "Left": [ "Uuid" ] }, "nullable": [] }, "hash": "9366095a4805111b455d1f28f179acaacae49621454ccfab34ebff80da5af868" }
0
.sqlx
/mono/.sqlx/query-3e360c5406d7086fa47689ac2372f314d856536e7005467258a3883b8b530de1.json
{ "db_name": "PostgreSQL", "query": "\n INSERT INTO vba_balance_ledgers (id, vba_id, amount, created_at)\n VALUES ($1, $2, $3, $4)\n ON CONFLICT (id) DO NOTHING\n ", "describe": { "columns": [], "parameters": { "Left": [ "Uuid", "Uuid", ...
0
.sqlx
/mono/.sqlx/query-994d2d33eccf006cf331c7e9f59c3fa48877d6cd1e99f478b4f2b52c2e04981e.json
{ "db_name": "PostgreSQL", "query": "DELETE FROM trade_metrics WHERE run_id = $1", "describe": { "columns": [], "parameters": { "Left": [ "Uuid" ] }, "nullable": [] }, "hash": "994d2d33eccf006cf331c7e9f59c3fa48877d6cd1e99f478b4f2b52c2e04981e" }
0
.sqlx
/mono/.sqlx/query-7cdd0c7cc51556e2289a409b52bbd34a83521b9c04b011fc2847414387ab74b8.json
{ "db_name": "PostgreSQL", "query": "DELETE FROM strategies WHERE id = $1", "describe": { "columns": [], "parameters": { "Left": [ "Uuid" ] }, "nullable": [] }, "hash": "7cdd0c7cc51556e2289a409b52bbd34a83521b9c04b011fc2847414387ab74b8" }
0
.sqlx
/mono/.sqlx/query-2f9d5a6d3b241c0157fe3f570ae165a407de6cb8c3207e77fc88b7ed3fcfabb8.json
{ "db_name": "PostgreSQL", "query": "\n INSERT INTO strat_balance_accounts (strat_run_id, vba_id)\n VALUES ($1, $2)\n ", "describe": { "columns": [], "parameters": { "Left": [ "Uuid", "Uuid" ] }, "nullable": [] }, "hash": "2f9d5a6d3b241c...
0
.sqlx
/mono/.sqlx/query-835737d03a7ea3713eb4e5df97f867952812d97574350c9e9bc6cb3f410b01c8.json
{ "db_name": "PostgreSQL", "query": "\n INSERT INTO account_details (id, name, account_id, venue)\n VALUES ($1, $2, $3, $4)\n ON CONFLICT (id) DO NOTHING\n ", "describe": { "columns": [], "parameters": { "Left": [ "Uuid", "Text", "Uuid"...
0
.sqlx
/mono/.sqlx/query-d61aae21438cd3337515decfce002879ca1936feb87d7e85dc9cfa50377cea1c.json
{ "db_name": "PostgreSQL", "query": "DELETE FROM strat_runs WHERE id = $1", "describe": { "columns": [], "parameters": { "Left": [ "Uuid" ] }, "nullable": [] }, "hash": "d61aae21438cd3337515decfce002879ca1936feb87d7e85dc9cfa50377cea1c" }
0
migrations
/mono/migrations/20230920121900_disallow_cancel_new_or_pending_order.sql
CREATE OR REPLACE FUNCTION check_cancellation_status_transition() RETURNS TRIGGER AS $$ BEGIN IF (OLD.order_status = 'FILLED' OR OLD.order_status = 'CANCELLED' OR OLD.order_status = 'ERROR') AND NEW.cancellation_status IS DISTINCT FROM OLD.cancellation_status THEN RAISE EXCEPTION 'Can not cancel ...
0
migrations
/mono/migrations/20240206200214_create_ohlcv_table.sql
CREATE TABLE if not exists ohlcv ( timestamp TIMESTAMPTZ, exchange exchange, interval int4, base asset, quote asset, open decimal NOT NULL, high decimal NOT NULL, low decimal ...
0
migrations
/mono/migrations/20230823183057_add_pair_field_to_db_tables.sql
CREATE OR REPLACE FUNCTION set_pair_column() RETURNS TRIGGER AS $$ BEGIN NEW.pair := NEW.base::TEXT || '_' || NEW.quote::TEXT; RETURN NEW; END; $$ LANGUAGE plpgsql; ALTER TABLE orders ADD COLUMN pair TEXT; CREATE TRIGGER set_pair_orders BEFORE INSERT ON orders FOR EACH ROW EXECUTE PROCEDURE set...
0
migrations
/mono/migrations/20240417224331_save_order_cdc.sql
-- Add migration script here CREATE OR REPLACE FUNCTION notify_order_execution_engine() RETURNS trigger AS $$ BEGIN PERFORM pg_notify('order_execution_engine', row_to_json(NEW)::text); RETURN NEW; END; $$ LANGUAGE plpgsql; CREATE TRIGGER emit_order_created AFTER INSERT OR UPDATE ON orders FOR EACH...
0
migrations
/mono/migrations/20230821190855_add_total_cost_to_orders.sql
-- Add migration script here ALTER TABLE orders ADD COLUMN total_cost decimal;
0
migrations
/mono/migrations/20231104191316_nullify_requested_cancellation_on_terminal_state.sql
-- Add migration script here ALTER type cancellation_status ADD VALUE 'ABORTED' BEFORE 'COMPLETE'; CREATE OR REPLACE FUNCTION nullify_requested_cancellation_on_change_to_terminal_state() RETURNS TRIGGER AS $$ BEGIN IF (NEW.order_status = 'FILLED' OR NEW.order_status = 'ERROR') AND OLD.cancellation_statu...
0
migrations
/mono/migrations/20240424202241_add_price_field_to_archive_table.sql
-- Add migration script here ALTER TABLE archive ADD COLUMN IF NOT EXISTS last_price decimal;
0
migrations
/mono/migrations/20231113191450_fix_orders_with_invalid_cancellation_status.sql
DROP TRIGGER orders_before_update_cancellation_status on orders; UPDATE orders SET cancellation_status = 'ABORTED' WHERE order_status IN ('FILLED', 'CANCELLED', 'ERROR') AND cancellation_status IS NOT NULL; CREATE TRIGGER orders_before_update_cancellation_status BEFORE UPDATE OF cancellation_status ON order...
0
migrations
/mono/migrations/20240425190420_revert_save_order_cdc.sql
DROP TRIGGER emit_order_created ON orders; DROP FUNCTION notify_order_execution_engine();
0
migrations
/mono/migrations/20240122165737_prevent_order_status_open_to_pending.sql
CREATE OR REPLACE FUNCTION prevent_order_status_open_to_pending() RETURNS TRIGGER AS $$ BEGIN IF NEW.order_status = 'PENDING' AND OLD.order_status = 'OPEN' THEN RAISE EXCEPTION 'Cannot update order status to pending if already open.'; END IF; RETURN NEW; END; $$ LANGUAGE plpgsql; CREATE TRIGGE...
0
migrations
/mono/migrations/20240415174112_add_run_id_field_to_orders_and_trades_tables.sql
ALTER TABLE trades ADD COLUMN IF NOT EXISTS strat_run_id uuid; ALTER TABLE orders ADD COLUMN IF NOT EXISTS strat_run_id uuid;
0
migrations
/mono/migrations/20240424180904_add_pnl_mv.sql
-- Create a stored procedure to refresh or create the materialized view CREATE OR REPLACE FUNCTION refresh_or_create_pnl_materialized_view() RETURNS VOID AS $$ BEGIN -- Check if the materialized view exists IF EXISTS (SELECT 1 FROM information_schema.views WHERE table_name = 'pnl_mv') THEN -- Refresh th...
0
migrations
/mono/migrations/20240523154427_add_indicators_table.sql
CREATE TABLE if not exists indicator_sma ( venue venue NOT NULL, pair text NOT NULL, period text NOT NULL, value jsonb NOT NULL, timestamp timestamp with time zone NOT NULL ); CREATE TABLE if not exists in...
0
migrations
/mono/migrations/20240423153544_remove_available_field_in_vba_table.sql
ALTER TABLE virtual_balance_accounts DROP COLUMN IF EXISTS available; ALTER TABLE balance_metrics DROP COLUMN IF EXISTS available_balance;
0
migrations
/mono/migrations/20230525221343_add_asset_enum_entries.sql
-- Add migration script here ALTER TYPE trading_strategy ADD VALUE 'UNKNOWN'; ALTER TYPE asset ADD VALUE 'GALA'; ALTER TYPE asset ADD VALUE 'WAXL'; ALTER TYPE asset ADD VALUE 'CHR'; ALTER TYPE asset ADD VALUE 'ALICE'; ALTER TYPE asset ADD VALUE 'ETC'; ALTER TYPE asset ADD VALUE 'POND'; ALTER TYPE asset ADD VALUE 'API3...
0
migrations
/mono/migrations/20230219195425_crate_kraken_collector_tables.sql
-- Add migration script here CREATE TYPE trading_strategy AS ENUM ( 'MARKET_MAKER_ON_TICKER', 'MIRROR', 'TRIANGULAR_ARBITRAGE' ); CREATE TYPE asset AS ENUM ( 'CAD', 'USD', 'BTC', 'ETH', 'DAI', 'USDT', 'EUR', 'LINK', 'SOL' ); CREATE TYPE exchange AS ENUM ( '...
0
migrations
/mono/migrations/20240216200955_adding_trade_metrics_table.sql
CREATE TABLE if not exists trade_metrics ( run_id uuid NOT NULL, profit decimal NOT NULL DEFAULT 0, average_cost decimal NOT NULL DEFAULT 0, vwap_delta decimal NOT NULL DEFAULT 0, average_sell decimal NOT NULL DEFAULT 0, volume_sold decimal NOT NULL DEFAULT 0,...
0
migrations
/mono/migrations/20240327131614_add_balance_metrics_table.sql
ALTER TABLE trade_metrics DROP COLUMN IF EXISTS base_available_balance, DROP COLUMN IF EXISTS quote_available_balance, DROP COLUMN IF EXISTS base_available_market_balance, DROP COLUMN IF EXISTS quote_available_market_balance, ADD COLUMN IF NOT EXISTS time_volume_weighted_average_cost decimal, AD...
0
migrations
/mono/migrations/20230920121809_remove_cancellation_requested_and_rename_status.sql
ALTER TYPE order_status RENAME TO order_status_old; CREATE TYPE order_status AS ENUM ( 'NEW', 'PENDING', 'OPEN', 'FILLED', 'CANCELLATION_PENDING', 'CANCELLED', 'ERROR' ); ALTER TABLE orders ADD COLUMN order_status order_status NOT NULL DEFAULT 'NEW'; UPDATE orders SET order_statu...
0
migrations
/mono/migrations/20231110194426_add_balance_tables.sql
CREATE TYPE account_status AS ENUM ( 'ACTIVE', 'INACTIVE' ); CREATE TABLE if not exists balance_accounts ( id uuid PRIMARY KEY, asset asset NOT NULL, amount decimal NOT NULL ); CREATE TABLE account_details ( id uuid PRIMARY KEY, name text NOT NULL, account_id u...
0
migrations
/mono/migrations/20240318183629_add_opportunity_tables.sql
CREATE TABLE if not exists opportunities ( id uuid PRIMARY KEY, run_id uuid NOT NULL ); CREATE TABLE if not exists opportunities_orders ( opportunity_id uuid NOT NULL, order_id uuid NOT NULL, PRIMARY KEY (opportunity_id, order_id), FOREIGN KEY (opportunity_id) ...
0
migrations
/mono/migrations/20230619143626_add_maker_only_order_type.sql
-- Add migration script here ALTER TYPE order_type ADD VALUE 'LIMIT_MAKER_ONLY';
0
migrations
/mono/migrations/20240410143925_add_venue_field_to_account_details.sql
CREATE TYPE venue AS ENUM ( 'KRAKEN', 'POLONIEX', 'COINBASE', 'BACKTEST' ); ALTER TABLE account_details ADD COLUMN IF NOT EXISTS venue venue NOT NULL;
0
migrations
/mono/migrations/20231123181245_adding_archive_service_tables.sql
-- Add migration script here CREATE TYPE archive_type AS ENUM ( 'TICKER', 'BOOK' ); CREATE TABLE if not exists archive ( exchange exchange NOT NULL, archive_type archive_type NOT NULL, base asset NOT NULL, quote asset ...
0
migrations
/mono/migrations/20240507163633_alter_pnl_function_to_use_time.sql
CREATE OR REPLACE FUNCTION refresh_or_create_pnl_materialized_view() RETURNS VOID AS $$ BEGIN -- Check if the materialized view exists IF EXISTS (SELECT 1 FROM information_schema.views WHERE table_name = 'pnl_mv') THEN -- Refresh the materialized view REFRESH MATERIALIZED VIEW pnl_mv; ELSE ...
0
migrations
/mono/migrations/20230920121828_add_cancellation_status.sql
CREATE TYPE cancellation_status AS ENUM ( 'REQUESTED', 'PENDING', 'COMPLETE' ); ALTER TABLE orders ADD COLUMN cancellation_status cancellation_status;
0
migrations
/mono/migrations/20230920121845_disallow_status_change_from_terminal_state.sql
CREATE OR REPLACE FUNCTION check_order_status_transition() RETURNS TRIGGER AS $$ BEGIN IF (OLD.order_status = 'FILLED' OR OLD.order_status = 'CANCELLED' OR OLD.order_status = 'ERROR') AND NEW.order_status != OLD.order_status THEN RAISE EXCEPTION 'Transition from FILLED, CANCELLED or ERROR to anot...
0
migrations
/mono/migrations/20240319141459_add_strat_tables.sql
CREATE TABLE strategies ( id uuid PRIMARY KEY, name trading_strategy NOT NULL ); CREATE TABLE strat_runs ( id uuid PRIMARY KEY, strat_id uuid NOT NULL, name text NOT NULL, meta jsonb, FOREIGN KEY (strat_id) REFERENCES strategies (id) ); CREATE TABLE strat_balance_accounts (...
0
migrations
/mono/migrations/20231106212123_disallow_decreasing_volume_filled.sql
CREATE OR REPLACE FUNCTION prevent_lower_volume_filled() RETURNS TRIGGER AS $$ BEGIN -- Check if the new volume_filled is less than the old volume_filled IF NEW.volume_filled < OLD.volume_filled THEN RAISE EXCEPTION 'Update rejected: volume_filled cannot be decreased.'; END IF; RETURN NEW; END;...
0
migrations
/mono/migrations/20240110171507_add_backtest_exchange_enum_variant.sql
-- Add migration script here ALTER TYPE exchange ADD VALUE 'BACKTEST';
0
docker
/mono/docker/.gitignore
# Make touch files .build/ .push/
0
docker
/mono/docker/Makefile
.build/makedeb: makedeb.Dockerfile docker buildx build -f makedeb.Dockerfile -t registry.gitlab.com/fdr-group/mono/ci/makedeb . --push docker build -f makedeb.Dockerfile -t registry.gitlab.com/fdr-group/mono/ci/makedeb . mkdir -p .build && date +%s > .build/grafana .push/makedeb: .build/makedeb docker push regist...
0
docker
/mono/docker/makedeb.Dockerfile
FROM ubuntu:22.04 RUN apt update && apt install -y wget gpg RUN wget -qO - 'https://proget.makedeb.org/debian-feeds/makedeb.pub' \ | gpg --dearmor | tee /usr/share/keyrings/makedeb-archive-keyring.gpg 1> /dev/null RUN echo 'deb [signed-by=/usr/share/keyrings/makedeb-archive-keyring.gpg arch=all] https://proget.m...
0
wsl
/mono/docker/wsl/.wslconfig
[wsl2] kernel=C:\\Users\\All Users\\bzImage
0
wsl
/mono/docker/wsl/build.sh
#!/bin/bash mkdir -p src && cd src if [ -d "WSL2-Linux-Kernel" ]; then echo "Directory exists." else git clone https://github.com/microsoft/WSL2-Linux-Kernel.git fi cd WSL2-Linux-Kernel sed -i 's/# CONFIG_NETFILTER_XT_MATCH_RECENT is not set/CONFIG_NETFILTER_XT_MATCH_RECENT=y/' Microsoft/config-wsl sed -i 's/-...
0
wsl
/mono/docker/wsl/Dockerfile
FROM ubuntu:latest ARG DEBIAN_FRONTEND=noninteractive RUN apt update && apt install -y \ build-essential \ flex \ bison \ dwarves \ libssl-dev \ libelf-dev \ python3 \ git \ bc WORKDIR /kernel ADD build.sh . CMD build.sh
0
rust
/mono/docker/rust/local.Dockerfile
# ---- Build Stage ---- FROM registry.gitlab.com/fdr-group/mono/rust-builder:latest AS build WORKDIR /app COPY . . RUN --mount=type=cache,target=/app/.cargo_docker_cache \ --mount=type=cache,target=/app/target/docker \ CARGO_BUILD_INCREMENTAL=true \ SQLX_OFFLINE=true \ PROFILE=debug \ CARGO_TARGET_D...
0
rust
/mono/docker/rust/sqlx-cli.Dockerfile
FROM registry.gitlab.com/fdr-group/mono/rust-builder:latest RUN cargo install sqlx-cli
0
rust
/mono/docker/rust/ci-release.Dockerfile
# ---- Release Image With Service Binary ---- # This image is used to run the service binary. # It is built on top of the base image and adds the service binary. FROM registry.gitlab.com/fdr-group/mono/fdr-service-base:latest ARG BINARY_NAME ARG BINARY_LOCATION ADD $BINARY_LOCATION /app/$BINARY_NAME ENV BINARY_NAME ...
0
rust
/mono/docker/rust/ci-base.Dockerfile
# ---- Base Release Image ---- # This image is used as the base for all release images. # It contains the necessary dependencies to run the service binary. FROM debian:bookworm ARG DEBIAN_FRONTEND=noninteractive RUN apt update && apt install -y \ openssl \ libssl-dev \ ca-certificates
0
rust
/mono/docker/rust/ci-builder.Dockerfile
# ---- Builder Image ---- FROM rust:1.77.2-slim-bookworm ARG DEBIAN_FRONTEND=noninteractive RUN apt update && apt install -y \ iputils-ping \ libpq-dev \ cmake \ pkg-config \ gcc \ g++ \ python3 \ libssl-dev \ protobuf-compiler \ git \ jq \ postgresql-client WORKDIR /app ...
0
postgresql-migrate
/mono/helm/postgresql-migrate/values.yaml
name: postgresql-migrate activeDeadlineSeconds: 60 # Allow the job to run for 1 minute
0
postgresql-migrate
/mono/helm/postgresql-migrate/Chart.yaml
apiVersion: v2 name: fdr-postgresql-migrate description: Run the PostgreSQL sqlx migrations. type: application version: "0.1.0"
0
values
/mono/helm/postgresql-migrate/values/dev.yaml
0
values
/mono/helm/postgresql-migrate/values/local.yaml
createSecrets: true secrets: postgresql_username: file://sym-secrets/postgresql_username postgresql_password: file://sym-secrets/postgresql_password # Enable to jump into the and debug # command: [sleep, inf] # activeDeadlineSeconds: 3600
0
files
/mono/helm/postgresql-migrate/files/migrate.sh
#!/bin/env sh echo "Decoding migrations" mkdir -p /migrations/decoded for file in /migrations/encoded/* do base64 -d "$file" > "/migrations/decoded/$(basename "$file")" done echo "Listing migrations:" find /migrations/decoded -type f -exec shasum {} \; | sort -k 2 export DATABASE_URL="postgres://${PGUSER}:${PGP...
0
templates
/mono/helm/postgresql-migrate/templates/cfgmap-migrations.yaml
{{/* Migrations are base 64 encoded to avoid problems caused by CR line endings being stripped */}} apiVersion: v1 kind: ConfigMap metadata: name: postgresql-migrations data: {{- $scope := . }} {{- range $migrationFile, $_ := .Files.Glob "migrations/*.sql" }} {{- with $scope }} {{ $migrationFile | base }}: {{ (.F...
0
templates
/mono/helm/postgresql-migrate/templates/job.yaml
{{ $scriptMountPath := "/postgresql/bin" }} {{- if .Values.createSecrets }} {{ include "common.secrets-v2" . }} {{- end }} --- apiVersion: batch/v1 kind: Job metadata: name: postgresql-migrate labels: helm.sh/chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" annotations: "helm.sh/hook": post-install,post-u...
0
strat-market-maker
/mono/helm/strat-market-maker/.helmignore
# Patterns to ignore when building packages. # This supports shell glob matching, relative path matching, and # negation (prefixed with !). Only one pattern per line. .DS_Store # Common VCS dirs .git/ .gitignore .bzr/ .bzrignore .hg/ .hgignore .svn/ # Common backup files *.swp *.bak *.tmp *.orig *~ # Various IDEs .proj...
0
strat-market-maker
/mono/helm/strat-market-maker/values.yaml
replicaCount: 1 name: strat-market-maker image: name: strat-market-maker repository: registry.gitlab.com/fdr-group/mono/rs/market-makers pullPolicy: IfNotPresent tag: "latest" imagePullSecrets: [] nameOverride: "" fullnameOverride: "strat-market-maker" serviceAccount: create: true annotations: {} name...
0
strat-market-maker
/mono/helm/strat-market-maker/Chart.yaml
apiVersion: v2 name: strat-market-maker description: Market Maker Strategy type: application version: 0.1.0 appVersion: "0.1.0"
0
strat-market-maker
/mono/helm/strat-market-maker/values-local.yaml
SERVICE: "strategy-manager" RUST_LOG: debug image: tag: "local" createSecrets: true configToml: | use_market_balance = true back_test = false run_id = "90d99ddf-ba11-480e-9a31-792670745053" [kafka_consumer] group_id = "market_makers" bootstrap_servers = "redpanda:9093" enable_partition_eof = "false"...
0
strat-market-maker
/mono/helm/strat-market-maker/values-dev.yaml
SERVICE: "strategy-manager" RUST_LOG: info imagePullSecrets: - name: gitlab-registry image: tag: "amd64-e5a12b4e" configToml: | use_market_balance = true backtest = false [kafka_consumer] group_id = "market_makers" bootstrap_servers = "redpanda.fdr-data.svc.cluster.local:9093" enable_partition_eof =...
0