moving to extravm
This commit is contained in:
725
algo.ipynb
725
algo.ipynb
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"execution_count": 10,
|
||||
"id": "d1eed397",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -22,7 +22,7 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 2,
|
||||
"execution_count": 11,
|
||||
"id": "c6151613",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -2600,88 +2600,6 @@
|
||||
"Decimal('1.0').quantize()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"1.0"
|
||||
]
|
||||
},
|
||||
"execution_count": 16,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"x = 1.0\n",
|
||||
"x"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 8,
|
||||
"id": "70b57870",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"f = ['b','a','z','e']"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"['b', 'a', 'z', 'e']"
|
||||
]
|
||||
},
|
||||
"execution_count": 9,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"f"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 10,
|
||||
"id": "9fd60c6e",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"f.sort()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 11,
|
||||
"id": "cd8b41de",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"['a', 'b', 'e', 'z']"
|
||||
]
|
||||
},
|
||||
"execution_count": 11,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"f"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 46,
|
||||
@@ -2699,125 +2617,42 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "57fac02c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"### Locked Values 🔒🔑 ###"
|
||||
]
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 124,
|
||||
"id": "8c2d003f",
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"from sqlalchemy.util.typing import Self\n",
|
||||
"from typing import Any\n",
|
||||
"from collections.abc import Sequence, Callable\n",
|
||||
"\n",
|
||||
"class Locked_Value(Sequence):\n",
|
||||
" def __init__(self, initial_value: Any, unlock_func: Callable):\n",
|
||||
" self._value: Any = initial_value\n",
|
||||
" self._unlock_func: Callable = unlock_func\n",
|
||||
" self._is_locked: bool = True\n",
|
||||
"\n",
|
||||
" def __repr__(self):\n",
|
||||
" return str((self._value, self._is_locked, self._unlock_func))\n",
|
||||
"\n",
|
||||
" def __len__(self):\n",
|
||||
" return len((self._value, self._is_locked, self._unlock_func))\n",
|
||||
"\n",
|
||||
" def __getitem__(self, index):\n",
|
||||
" return (self._value, self._is_locked, self._unlock_func)[index]\n",
|
||||
"\n",
|
||||
" def __str__(self):\n",
|
||||
" return str((self._value))\n",
|
||||
"\n",
|
||||
" def unlock(self) -> Self:\n",
|
||||
" if self._unlock_func():\n",
|
||||
" self._is_locked = False\n",
|
||||
" return self\n",
|
||||
"\n",
|
||||
" @property\n",
|
||||
" def is_locked(self):\n",
|
||||
" return self._is_locked\n",
|
||||
"\n",
|
||||
" @property\n",
|
||||
" def value(self):\n",
|
||||
" return self._value\n",
|
||||
"\n",
|
||||
" @value.setter\n",
|
||||
" def value(self, v):\n",
|
||||
" if not(self._is_locked):\n",
|
||||
" self._value = v\n",
|
||||
" else:\n",
|
||||
" raise ValueError(f'Failed to set value, item is locked: {str(self.__repr__)}')\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 155,
|
||||
"id": "6fd6a46c",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"class Current_Previous_Value:\n",
|
||||
" def __init__(self, value: Any = None, previous_value: Any = None):\n",
|
||||
" self._value: Any = value\n",
|
||||
" self._previous_value: Any = previous_value\n",
|
||||
"\n",
|
||||
" def __repr__(self):\n",
|
||||
" return str((self._value, self._previous_value))\n",
|
||||
"\n",
|
||||
" def __len__(self):\n",
|
||||
" return len((self._value, self._previous_value))\n",
|
||||
"\n",
|
||||
" def __getitem__(self, index):\n",
|
||||
" return (self._value, self._previous_value)[index]\n",
|
||||
"\n",
|
||||
" def __str__(self):\n",
|
||||
" return str(self._value)\n",
|
||||
"\n",
|
||||
" @property\n",
|
||||
" def value(self):\n",
|
||||
" return self._value\n",
|
||||
"\n",
|
||||
" @property\n",
|
||||
" def previous_value(self):\n",
|
||||
" return self._previous_value\n",
|
||||
"\n",
|
||||
" @value.setter\n",
|
||||
" def value(self, v):\n",
|
||||
" self._previous_value = self._value\n",
|
||||
" self._value = v\n"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 156,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vo = Current_Previous_Value()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 163,
|
||||
"id": "b557d932",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"vo.value = 1\n",
|
||||
"vo.value = 2"
|
||||
"df = pd.DataFrame(json.loads(VAL_KEY.get('fr_engine_best_fund_rate_master'))) # ty:ignore[invalid-argument-type]"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "ef1d4ce0",
|
||||
"id": "d1413506",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"\n",
|
||||
"\n",
|
||||
"col_extras = {\n",
|
||||
" 'symbol_ast': {\n",
|
||||
" 'editable': False, \n",
|
||||
" 'sortable': True\n",
|
||||
" }\n",
|
||||
"}\n",
|
||||
"cols = [ {'field': v, **col_extras.get(v, {})} for v in df.columns ]\n",
|
||||
"rows = df.to_dict(orient='records')"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "fcad79c3",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
@@ -2825,142 +2660,318 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 131,
|
||||
"id": "04efe6cc",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"v = 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 132,
|
||||
"id": "36b56800",
|
||||
"id": "d6f23c60",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"1"
|
||||
"[{'symbol_ast': 'LITUSDT',\n",
|
||||
" 'max_leverage_ast': 50,\n",
|
||||
" 'lh_asset_ast': 'LIT',\n",
|
||||
" 'rh_asset_ast': 'USDT',\n",
|
||||
" 'funding_rate_ast': 0.00011009,\n",
|
||||
" 'min_price_ast': '0.0001000',\n",
|
||||
" 'min_order_size_ast': '1',\n",
|
||||
" 'min_lot_size_ast': '1',\n",
|
||||
" 'min_notional_ast': '5',\n",
|
||||
" 'buy_ratio_ast': -0.0005956543,\n",
|
||||
" 'symbol_ext': 'LIT-USD',\n",
|
||||
" 'max_leverage_ext': 25,\n",
|
||||
" 'lh_asset_ext': 'LIT',\n",
|
||||
" 'rh_asset_ext': 'USD',\n",
|
||||
" 'funding_rate_ext': 1.3e-05,\n",
|
||||
" 'min_price_ext': '0.0001',\n",
|
||||
" 'min_order_size_ext': '10',\n",
|
||||
" 'min_lot_size_ext': '1',\n",
|
||||
" 'min_notional_ext': 0.0,\n",
|
||||
" 'buy_ratio_ext': 0.0005956543,\n",
|
||||
" 'buy_ratio_std': 0.0007698555,\n",
|
||||
" 'next_funding_at_same_time': True,\n",
|
||||
" 'id': 0},\n",
|
||||
" {'symbol_ast': 'HYPEUSDT',\n",
|
||||
" 'max_leverage_ast': 300,\n",
|
||||
" 'lh_asset_ast': 'HYPE',\n",
|
||||
" 'rh_asset_ast': 'USDT',\n",
|
||||
" 'funding_rate_ast': 5e-05,\n",
|
||||
" 'min_price_ast': '0.00100',\n",
|
||||
" 'min_order_size_ast': '0.01',\n",
|
||||
" 'min_lot_size_ast': '0.01',\n",
|
||||
" 'min_notional_ast': '5',\n",
|
||||
" 'buy_ratio_ast': -0.0002001154,\n",
|
||||
" 'symbol_ext': 'HYPE-USD',\n",
|
||||
" 'max_leverage_ext': 50,\n",
|
||||
" 'lh_asset_ext': 'HYPE',\n",
|
||||
" 'rh_asset_ext': 'USD',\n",
|
||||
" 'funding_rate_ext': 1.3e-05,\n",
|
||||
" 'min_price_ext': '0.001',\n",
|
||||
" 'min_order_size_ext': '0.1',\n",
|
||||
" 'min_lot_size_ext': '0.01',\n",
|
||||
" 'min_notional_ext': 0.0,\n",
|
||||
" 'buy_ratio_ext': 0.0002001154,\n",
|
||||
" 'buy_ratio_std': 0.0002123501,\n",
|
||||
" 'next_funding_at_same_time': False,\n",
|
||||
" 'id': 1},\n",
|
||||
" {'symbol_ast': 'SOLUSDT',\n",
|
||||
" 'max_leverage_ast': 100,\n",
|
||||
" 'lh_asset_ast': 'SOL',\n",
|
||||
" 'rh_asset_ast': 'USDT',\n",
|
||||
" 'funding_rate_ast': 0.0001,\n",
|
||||
" 'min_price_ast': '0.4200',\n",
|
||||
" 'min_order_size_ast': '0.01',\n",
|
||||
" 'min_lot_size_ast': '0.01',\n",
|
||||
" 'min_notional_ast': '5',\n",
|
||||
" 'buy_ratio_ast': -0.0004271435,\n",
|
||||
" 'symbol_ext': 'SOL-USD',\n",
|
||||
" 'max_leverage_ext': 50,\n",
|
||||
" 'lh_asset_ext': 'SOL',\n",
|
||||
" 'rh_asset_ext': 'USD',\n",
|
||||
" 'funding_rate_ext': -1.4e-05,\n",
|
||||
" 'min_price_ext': '0.01',\n",
|
||||
" 'min_order_size_ext': '0.1',\n",
|
||||
" 'min_lot_size_ext': '0.01',\n",
|
||||
" 'min_notional_ext': 0.0,\n",
|
||||
" 'buy_ratio_ext': 0.0004271435,\n",
|
||||
" 'buy_ratio_std': 9.37564e-05,\n",
|
||||
" 'next_funding_at_same_time': False,\n",
|
||||
" 'id': 2},\n",
|
||||
" {'symbol_ast': 'BNBUSDT',\n",
|
||||
" 'max_leverage_ast': 100,\n",
|
||||
" 'lh_asset_ast': 'BNB',\n",
|
||||
" 'rh_asset_ast': 'USDT',\n",
|
||||
" 'funding_rate_ast': 0.00012242,\n",
|
||||
" 'min_price_ast': '0.010',\n",
|
||||
" 'min_order_size_ast': '0.01',\n",
|
||||
" 'min_lot_size_ast': '0.01',\n",
|
||||
" 'min_notional_ast': '5',\n",
|
||||
" 'buy_ratio_ast': -0.0011992245,\n",
|
||||
" 'symbol_ext': 'BNB-USD',\n",
|
||||
" 'max_leverage_ext': 50,\n",
|
||||
" 'lh_asset_ext': 'BNB',\n",
|
||||
" 'rh_asset_ext': 'USD',\n",
|
||||
" 'funding_rate_ext': 1.3e-05,\n",
|
||||
" 'min_price_ext': '0.01',\n",
|
||||
" 'min_order_size_ext': '0.01',\n",
|
||||
" 'min_lot_size_ext': '0.001',\n",
|
||||
" 'min_notional_ext': 0.0,\n",
|
||||
" 'buy_ratio_ext': 0.0011992245,\n",
|
||||
" 'buy_ratio_std': 5.93637e-05,\n",
|
||||
" 'next_funding_at_same_time': False,\n",
|
||||
" 'id': 3},\n",
|
||||
" {'symbol_ast': 'XRPUSDT',\n",
|
||||
" 'max_leverage_ast': 100,\n",
|
||||
" 'lh_asset_ast': 'XRP',\n",
|
||||
" 'rh_asset_ast': 'USDT',\n",
|
||||
" 'funding_rate_ast': 4.038e-05,\n",
|
||||
" 'min_price_ast': '0.0143',\n",
|
||||
" 'min_order_size_ast': '0.1',\n",
|
||||
" 'min_lot_size_ast': '0.1',\n",
|
||||
" 'min_notional_ast': '5',\n",
|
||||
" 'buy_ratio_ast': -0.0001086996,\n",
|
||||
" 'symbol_ext': 'XRP-USD',\n",
|
||||
" 'max_leverage_ext': 50,\n",
|
||||
" 'lh_asset_ext': 'XRP',\n",
|
||||
" 'rh_asset_ext': 'USD',\n",
|
||||
" 'funding_rate_ext': 1.3e-05,\n",
|
||||
" 'min_price_ext': '0.0001',\n",
|
||||
" 'min_order_size_ext': '10',\n",
|
||||
" 'min_lot_size_ext': '1',\n",
|
||||
" 'min_notional_ext': 0.0,\n",
|
||||
" 'buy_ratio_ext': 0.0001086996,\n",
|
||||
" 'buy_ratio_std': 8.12797e-05,\n",
|
||||
" 'next_funding_at_same_time': False,\n",
|
||||
" 'id': 4},\n",
|
||||
" {'symbol_ast': 'DOGEUSDT',\n",
|
||||
" 'max_leverage_ast': 75,\n",
|
||||
" 'lh_asset_ast': 'DOGE',\n",
|
||||
" 'rh_asset_ast': 'USDT',\n",
|
||||
" 'funding_rate_ast': -5.33e-06,\n",
|
||||
" 'min_price_ast': '0.002440',\n",
|
||||
" 'min_order_size_ast': '1',\n",
|
||||
" 'min_lot_size_ast': '1',\n",
|
||||
" 'min_notional_ast': '5',\n",
|
||||
" 'buy_ratio_ast': 0.0010192971,\n",
|
||||
" 'symbol_ext': 'DOGE-USD',\n",
|
||||
" 'max_leverage_ext': 50,\n",
|
||||
" 'lh_asset_ext': 'DOGE',\n",
|
||||
" 'rh_asset_ext': 'USD',\n",
|
||||
" 'funding_rate_ext': 1.3e-05,\n",
|
||||
" 'min_price_ext': '0.00001',\n",
|
||||
" 'min_order_size_ext': '100',\n",
|
||||
" 'min_lot_size_ext': '10',\n",
|
||||
" 'min_notional_ext': 0.0,\n",
|
||||
" 'buy_ratio_ext': -0.0010192971,\n",
|
||||
" 'buy_ratio_std': 8.60126e-05,\n",
|
||||
" 'next_funding_at_same_time': False,\n",
|
||||
" 'id': 5},\n",
|
||||
" {'symbol_ast': 'SUIUSDT',\n",
|
||||
" 'max_leverage_ast': 75,\n",
|
||||
" 'lh_asset_ast': 'SUI',\n",
|
||||
" 'rh_asset_ast': 'USDT',\n",
|
||||
" 'funding_rate_ast': 0.0001,\n",
|
||||
" 'min_price_ast': '0.000100',\n",
|
||||
" 'min_order_size_ast': '0.1',\n",
|
||||
" 'min_lot_size_ast': '0.1',\n",
|
||||
" 'min_notional_ast': '5',\n",
|
||||
" 'buy_ratio_ast': 0.0002862497,\n",
|
||||
" 'symbol_ext': 'SUI-USD',\n",
|
||||
" 'max_leverage_ext': 50,\n",
|
||||
" 'lh_asset_ext': 'SUI',\n",
|
||||
" 'rh_asset_ext': 'USD',\n",
|
||||
" 'funding_rate_ext': 1.3e-05,\n",
|
||||
" 'min_price_ext': '0.0001',\n",
|
||||
" 'min_order_size_ext': '10',\n",
|
||||
" 'min_lot_size_ext': '1',\n",
|
||||
" 'min_notional_ext': 0.0,\n",
|
||||
" 'buy_ratio_ext': -0.0002862497,\n",
|
||||
" 'buy_ratio_std': 0.0005447464,\n",
|
||||
" 'next_funding_at_same_time': False,\n",
|
||||
" 'id': 6},\n",
|
||||
" {'symbol_ast': 'BTCUSDT',\n",
|
||||
" 'max_leverage_ast': 150,\n",
|
||||
" 'lh_asset_ast': 'BTC',\n",
|
||||
" 'rh_asset_ast': 'USDT',\n",
|
||||
" 'funding_rate_ast': -5.216e-05,\n",
|
||||
" 'min_price_ast': '1',\n",
|
||||
" 'min_order_size_ast': '0.001',\n",
|
||||
" 'min_lot_size_ast': '0.001',\n",
|
||||
" 'min_notional_ast': '5',\n",
|
||||
" 'buy_ratio_ast': -0.000104008,\n",
|
||||
" 'symbol_ext': 'BTC-USD',\n",
|
||||
" 'max_leverage_ext': 50,\n",
|
||||
" 'lh_asset_ext': 'BTC',\n",
|
||||
" 'rh_asset_ext': 'USD',\n",
|
||||
" 'funding_rate_ext': -8e-06,\n",
|
||||
" 'min_price_ext': '1',\n",
|
||||
" 'min_order_size_ext': '0.0001',\n",
|
||||
" 'min_lot_size_ext': '0.00001',\n",
|
||||
" 'min_notional_ext': 0.0,\n",
|
||||
" 'buy_ratio_ext': 0.000104008,\n",
|
||||
" 'buy_ratio_std': 0.0001018788,\n",
|
||||
" 'next_funding_at_same_time': False,\n",
|
||||
" 'id': 7},\n",
|
||||
" {'symbol_ast': 'CHIPUSDT',\n",
|
||||
" 'max_leverage_ast': 50,\n",
|
||||
" 'lh_asset_ast': 'CHIP',\n",
|
||||
" 'rh_asset_ast': 'USDT',\n",
|
||||
" 'funding_rate_ast': 1.25e-05,\n",
|
||||
" 'min_price_ast': '0.0000100',\n",
|
||||
" 'min_order_size_ast': '1',\n",
|
||||
" 'min_lot_size_ast': '1',\n",
|
||||
" 'min_notional_ast': '5',\n",
|
||||
" 'buy_ratio_ast': -0.0007168459,\n",
|
||||
" 'symbol_ext': 'CHIP-USD',\n",
|
||||
" 'max_leverage_ext': 5,\n",
|
||||
" 'lh_asset_ext': 'CHIP',\n",
|
||||
" 'rh_asset_ext': 'USD',\n",
|
||||
" 'funding_rate_ext': -4.6e-05,\n",
|
||||
" 'min_price_ext': '0.000001',\n",
|
||||
" 'min_order_size_ext': '100',\n",
|
||||
" 'min_lot_size_ext': '10',\n",
|
||||
" 'min_notional_ext': 0.0,\n",
|
||||
" 'buy_ratio_ext': 0.0007168459,\n",
|
||||
" 'buy_ratio_std': 0.0014437729,\n",
|
||||
" 'next_funding_at_same_time': True,\n",
|
||||
" 'id': 8},\n",
|
||||
" {'symbol_ast': 'ASTERUSDT',\n",
|
||||
" 'max_leverage_ast': 75,\n",
|
||||
" 'lh_asset_ast': 'ASTER',\n",
|
||||
" 'rh_asset_ast': 'USDT',\n",
|
||||
" 'funding_rate_ast': 5e-05,\n",
|
||||
" 'min_price_ast': '0.00010',\n",
|
||||
" 'min_order_size_ast': '0.01',\n",
|
||||
" 'min_lot_size_ast': '0.01',\n",
|
||||
" 'min_notional_ast': '5',\n",
|
||||
" 'buy_ratio_ast': -0.0001497055,\n",
|
||||
" 'symbol_ext': 'ASTER-USD',\n",
|
||||
" 'max_leverage_ext': 25,\n",
|
||||
" 'lh_asset_ext': 'ASTER',\n",
|
||||
" 'rh_asset_ext': 'USD',\n",
|
||||
" 'funding_rate_ext': 1.3e-05,\n",
|
||||
" 'min_price_ext': '0.00001',\n",
|
||||
" 'min_order_size_ext': '10',\n",
|
||||
" 'min_lot_size_ext': '1',\n",
|
||||
" 'min_notional_ext': 0.0,\n",
|
||||
" 'buy_ratio_ext': 0.0001497055,\n",
|
||||
" 'buy_ratio_std': 0.0001520848,\n",
|
||||
" 'next_funding_at_same_time': False,\n",
|
||||
" 'id': 9},\n",
|
||||
" {'symbol_ast': 'ETHUSDT',\n",
|
||||
" 'max_leverage_ast': 150,\n",
|
||||
" 'lh_asset_ast': 'ETH',\n",
|
||||
" 'rh_asset_ast': 'USDT',\n",
|
||||
" 'funding_rate_ast': -2.051e-05,\n",
|
||||
" 'min_price_ast': '0.01',\n",
|
||||
" 'min_order_size_ast': '0.001',\n",
|
||||
" 'min_lot_size_ast': '0.001',\n",
|
||||
" 'min_notional_ast': '5',\n",
|
||||
" 'buy_ratio_ast': -8.96077e-05,\n",
|
||||
" 'symbol_ext': 'ETH-USD',\n",
|
||||
" 'max_leverage_ext': 50,\n",
|
||||
" 'lh_asset_ext': 'ETH',\n",
|
||||
" 'rh_asset_ext': 'USD',\n",
|
||||
" 'funding_rate_ext': 4e-06,\n",
|
||||
" 'min_price_ext': '0.1',\n",
|
||||
" 'min_order_size_ext': '0.01',\n",
|
||||
" 'min_lot_size_ext': '0.001',\n",
|
||||
" 'min_notional_ext': 0.0,\n",
|
||||
" 'buy_ratio_ext': 8.96077e-05,\n",
|
||||
" 'buy_ratio_std': 8.24728e-05,\n",
|
||||
" 'next_funding_at_same_time': False,\n",
|
||||
" 'id': 10},\n",
|
||||
" {'symbol_ast': 'ZECUSDT',\n",
|
||||
" 'max_leverage_ast': 75,\n",
|
||||
" 'lh_asset_ast': 'ZEC',\n",
|
||||
" 'rh_asset_ast': 'USDT',\n",
|
||||
" 'funding_rate_ast': -1.06e-06,\n",
|
||||
" 'min_price_ast': '0.0100',\n",
|
||||
" 'min_order_size_ast': '0.001',\n",
|
||||
" 'min_lot_size_ast': '0.001',\n",
|
||||
" 'min_notional_ast': '5',\n",
|
||||
" 'buy_ratio_ast': 0.000456781,\n",
|
||||
" 'symbol_ext': 'ZEC-USD',\n",
|
||||
" 'max_leverage_ext': 10,\n",
|
||||
" 'lh_asset_ext': 'ZEC',\n",
|
||||
" 'rh_asset_ext': 'USD',\n",
|
||||
" 'funding_rate_ext': 1.3e-05,\n",
|
||||
" 'min_price_ext': '0.001',\n",
|
||||
" 'min_order_size_ext': '0.1',\n",
|
||||
" 'min_lot_size_ext': '0.1',\n",
|
||||
" 'min_notional_ext': 0.0,\n",
|
||||
" 'buy_ratio_ext': -0.000456781,\n",
|
||||
" 'buy_ratio_std': 0.0008927931,\n",
|
||||
" 'next_funding_at_same_time': True,\n",
|
||||
" 'id': 11},\n",
|
||||
" {'symbol_ast': 'WLFIUSDT',\n",
|
||||
" 'max_leverage_ast': 25,\n",
|
||||
" 'lh_asset_ast': 'WLFI',\n",
|
||||
" 'rh_asset_ast': 'USDT',\n",
|
||||
" 'funding_rate_ast': 5e-05,\n",
|
||||
" 'min_price_ast': '0.0001000',\n",
|
||||
" 'min_order_size_ast': '1',\n",
|
||||
" 'min_lot_size_ast': '1',\n",
|
||||
" 'min_notional_ast': '5',\n",
|
||||
" 'buy_ratio_ast': 0.0008577801,\n",
|
||||
" 'symbol_ext': 'WLFI-USD',\n",
|
||||
" 'max_leverage_ext': 10,\n",
|
||||
" 'lh_asset_ext': 'WLFI',\n",
|
||||
" 'rh_asset_ext': 'USD',\n",
|
||||
" 'funding_rate_ext': 1.3e-05,\n",
|
||||
" 'min_price_ext': '0.00001',\n",
|
||||
" 'min_order_size_ext': '100',\n",
|
||||
" 'min_lot_size_ext': '10',\n",
|
||||
" 'min_notional_ext': 0.0,\n",
|
||||
" 'buy_ratio_ext': -0.0008577801,\n",
|
||||
" 'buy_ratio_std': 0.0006254649,\n",
|
||||
" 'next_funding_at_same_time': False,\n",
|
||||
" 'id': 12}]"
|
||||
]
|
||||
},
|
||||
"execution_count": 132,
|
||||
"execution_count": 34,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"v"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 133,
|
||||
"id": "e24ff466",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"v = 2"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 134,
|
||||
"id": "b5ee5afa",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"2"
|
||||
]
|
||||
},
|
||||
"execution_count": 134,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"v"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "74051e1d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"def test():\n",
|
||||
" return False"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 128,
|
||||
"id": "38ee912d",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"v = Locked_Value('locked', unlock_func=test)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 129,
|
||||
"id": "bb703d87",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"ename": "ValueError",
|
||||
"evalue": "Failed to set value, item is locked: <bound method Locked_Value.__repr__ of ('locked', True, <function test at 0x76725ff485e0>)>",
|
||||
"output_type": "error",
|
||||
"traceback": [
|
||||
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
|
||||
"\u001b[31mValueError\u001b[39m Traceback (most recent call last)",
|
||||
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[129]\u001b[39m\u001b[32m, line 1\u001b[39m\n\u001b[32m----> \u001b[39m\u001b[32m1\u001b[39m v.unlock().value = \u001b[33m'unlocked'\u001b[39m\n",
|
||||
"\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[124]\u001b[39m\u001b[32m, line 41\u001b[39m, in \u001b[36mLocked_Value.value\u001b[39m\u001b[34m(self, v)\u001b[39m\n\u001b[32m 37\u001b[39m \u001b[38;5;28;01mdef\u001b[39;00m value(self, v):\n\u001b[32m 38\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28;01mnot\u001b[39;00m(self._is_locked):\n\u001b[32m 39\u001b[39m self._value = v\n\u001b[32m 40\u001b[39m \u001b[38;5;28;01melse\u001b[39;00m:\n\u001b[32m---> \u001b[39m\u001b[32m41\u001b[39m \u001b[38;5;28;01mraise\u001b[39;00m ValueError(f'Failed to set value, item is locked: {str(self.__repr__)}')\n",
|
||||
"\u001b[31mValueError\u001b[39m: Failed to set value, item is locked: <bound method Locked_Value.__repr__ of ('locked', True, <function test at 0x76725ff485e0>)>"
|
||||
]
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"v.unlock().value = 'unlocked'"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 123,
|
||||
"id": "76c44d97",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"('locked', True, <function test at 0x767268132520>)"
|
||||
]
|
||||
},
|
||||
"execution_count": 123,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"v"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
@@ -2973,66 +2984,7 @@
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 62,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"lv = Locked_Value(initial_value=999)\n",
|
||||
"# lv.unlock()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 65,
|
||||
"id": "76e21865",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"2"
|
||||
]
|
||||
},
|
||||
"execution_count": 65,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"len(lv)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 32,
|
||||
"id": "10258f5b",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"(999, False)"
|
||||
]
|
||||
},
|
||||
"execution_count": 32,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"lv"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "9270dd8d",
|
||||
"id": "93323174",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
@@ -3044,29 +2996,6 @@
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "a938b2e0",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "39667bd8",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
|
||||
Reference in New Issue
Block a user