{ "cells": [ { "cell_type": "code", "execution_count": 7, "id": "d1eed397", "metadata": {}, "outputs": [], "source": [ "import modules.structs as structs\n", "import json\n", "from dataclasses import dataclass, asdict\n", "import valkey\n", "\n", "with open('algo_config.json', 'r', encoding='utf-8') as file:\n", " ALGO_CONFIG = json.load(file, object_hook=lambda d: structs.Algo_Config(**d))" ] }, { "cell_type": "code", "execution_count": 8, "id": "c6151613", "metadata": {}, "outputs": [], "source": [ "VAL_KEY = valkey.Valkey(host='localhost', port=6379, db=0, decode_responses=True)" ] }, { "cell_type": "code", "execution_count": 31, "id": "d83c61e5", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "1" ] }, "execution_count": 31, "metadata": {}, "output_type": "execute_result" } ], "source": [ "config_update = {\n", " 'Min_Time_To_Funding_Minutes': 60,\n", " 'Print_Summary_Each_Loop': True,\n", " 'Allow_Ordering_Aster': True,\n", " 'Allow_Ordering_Extend': True,\n", " 'Loop_Sleep_Sec': 0.0,\n", " 'Flip_Side_For_Testing': False,\n", " 'Price_Worsener_Extend': 0.0,\n", "}\n", "VAL_KEY.publish('fr_orchestrator_input', json.dumps(config_update))" ] }, { "cell_type": "code", "execution_count": null, "id": "d2fdd7d2", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": 11, "id": "45fae761", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "Algo_Config(Config_Updated_Timestamp=1777151524162, Allow_Ordering_Aster=True, Allow_Ordering_Extend=True, Loop_Sleep_Sec=1, Max_Target_Notional=0.0, Min_Time_To_Funding_Minutes=60, Price_Worsener_Aster=0.0, Price_Worsener_Extend=0.0, Target_Open_Cash_Position=10)" ] }, "execution_count": 11, "metadata": {}, "output_type": "execute_result" } ], "source": [ "json.loads(VAL_KEY.get('fr_orchestrator_output'), object_hook=lambda d: structs.Algo_Config(**d))" ] }, { "cell_type": "code", "execution_count": 9, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'Config_Updated_Timestamp': 1777098091913,\n", " 'Allow_Ordering_Aster': False,\n", " 'Allow_Ordering_Extend': False,\n", " 'Loop_Sleep_Sec': 1,\n", " 'Max_Target_Notional': 0.0,\n", " 'Min_Time_To_Funding_Minutes': 60,\n", " 'Price_Worsener_Aster': 0.0,\n", " 'Price_Worsener_Extend': 0.0,\n", " 'Target_Open_Cash_Position': 10,\n", " 'Print_Summary_Each_Loop': False,\n", " 'Flip_Side_For_Testing': False}" ] }, "execution_count": 9, "metadata": {}, "output_type": "execute_result" } ], "source": [ "asdict(ALGO_CONFIG)" ] }, { "cell_type": "code", "execution_count": null, "id": "d2e26271", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "a0df43de", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "py_313", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.12" } }, "nbformat": 4, "nbformat_minor": 5 }