mirror of
https://github.com/Ichinga-Samuel/aiomql.git
synced 2026-08-15 21:08:06 +00:00
testdata
This commit is contained in:
+61
-105
@@ -2,7 +2,7 @@
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 5,
|
||||
"execution_count": 1,
|
||||
"id": "f4500c8d-0e58-4d3f-8dd3-06a4896f397f",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
@@ -41,9 +41,52 @@
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 19,
|
||||
"execution_count": 3,
|
||||
"id": "2c598a85-1e90-49b0-abf1-87329597feae",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"True"
|
||||
]
|
||||
},
|
||||
"execution_count": 3,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"sym = Symbol(name='Volatility 25 Index')\n",
|
||||
"await sym.init()"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 13,
|
||||
"id": "0a7d319c-5760-4058-994f-27e8d10df108",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"0.5"
|
||||
]
|
||||
},
|
||||
"execution_count": 13,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"await sym.mt5.order_calc_margin(0, 'Volatility 25 Index', 1, sym.tick.ask)"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 17,
|
||||
"id": "4ec498ea-5e4e-4ff6-85da-051acc2eaf28",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
@@ -51,136 +94,49 @@
|
||||
"4"
|
||||
]
|
||||
},
|
||||
"execution_count": 19,
|
||||
"execution_count": 17,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"tz = pytz.timezone('Etc/UTC')\n",
|
||||
"sym = Symbol(name='EURUSD')\n",
|
||||
"start = datetime(day=22, month=8, year=2024, tzinfo=tz)\n",
|
||||
"end = datetime(day=26, month=8, year=2024, hour=12, tzinfo=tz)\n",
|
||||
"# rates = await sym.mt5.copy_rates_from(symbol='EURUSD', date_from=end, count=5, timeframe=TimeFrame.H12)\n",
|
||||
"rates = await sym.mt5.copy_rates_from_pos(symbol='EURUSD', start_pos=0, count=5, timeframe=TimeFrame.H12)\n",
|
||||
"df = DataFrame(rates)\n",
|
||||
"df['time'] = pd.to_datetime(df['time'], unit='s')\n",
|
||||
"df.index[-1]"
|
||||
"sy = await sym.mt5.symbol_info('Volatility 25 Index')\n",
|
||||
"await sym.mt5.symbol_select('Volatility 25 Index', enable=True)\n",
|
||||
"sy.trade_calc_mode"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 30,
|
||||
"id": "0a7d319c-5760-4058-994f-27e8d10df108",
|
||||
"execution_count": 12,
|
||||
"id": "9307e3df-a5f3-42cf-9d3d-e65e5254c0e5",
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/html": [
|
||||
"<div>\n",
|
||||
"<style scoped>\n",
|
||||
" .dataframe tbody tr th:only-of-type {\n",
|
||||
" vertical-align: middle;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe tbody tr th {\n",
|
||||
" vertical-align: top;\n",
|
||||
" }\n",
|
||||
"\n",
|
||||
" .dataframe thead th {\n",
|
||||
" text-align: right;\n",
|
||||
" }\n",
|
||||
"</style>\n",
|
||||
"<table border=\"1\" class=\"dataframe\">\n",
|
||||
" <thead>\n",
|
||||
" <tr style=\"text-align: right;\">\n",
|
||||
" <th></th>\n",
|
||||
" <th>time</th>\n",
|
||||
" <th>open</th>\n",
|
||||
" <th>high</th>\n",
|
||||
" <th>low</th>\n",
|
||||
" <th>close</th>\n",
|
||||
" <th>tick_volume</th>\n",
|
||||
" <th>spread</th>\n",
|
||||
" <th>real_volume</th>\n",
|
||||
" </tr>\n",
|
||||
" </thead>\n",
|
||||
" <tbody>\n",
|
||||
" <tr>\n",
|
||||
" <th>2</th>\n",
|
||||
" <td>2024-08-25 12:00:00</td>\n",
|
||||
" <td>1.11869</td>\n",
|
||||
" <td>1.11947</td>\n",
|
||||
" <td>1.11849</td>\n",
|
||||
" <td>1.11894</td>\n",
|
||||
" <td>4570</td>\n",
|
||||
" <td>1</td>\n",
|
||||
" <td>0</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>3</th>\n",
|
||||
" <td>2024-08-26 00:00:00</td>\n",
|
||||
" <td>1.11894</td>\n",
|
||||
" <td>1.12016</td>\n",
|
||||
" <td>1.11628</td>\n",
|
||||
" <td>1.11652</td>\n",
|
||||
" <td>43583</td>\n",
|
||||
" <td>0</td>\n",
|
||||
" <td>0</td>\n",
|
||||
" </tr>\n",
|
||||
" <tr>\n",
|
||||
" <th>4</th>\n",
|
||||
" <td>2024-08-26 12:00:00</td>\n",
|
||||
" <td>1.11652</td>\n",
|
||||
" <td>1.11790</td>\n",
|
||||
" <td>1.11501</td>\n",
|
||||
" <td>1.11618</td>\n",
|
||||
" <td>45034</td>\n",
|
||||
" <td>0</td>\n",
|
||||
" <td>0</td>\n",
|
||||
" </tr>\n",
|
||||
" </tbody>\n",
|
||||
"</table>\n",
|
||||
"</div>"
|
||||
],
|
||||
"text/plain": [
|
||||
" time open high low close tick_volume \\\n",
|
||||
"2 2024-08-25 12:00:00 1.11869 1.11947 1.11849 1.11894 4570 \n",
|
||||
"3 2024-08-26 00:00:00 1.11894 1.12016 1.11628 1.11652 43583 \n",
|
||||
"4 2024-08-26 12:00:00 1.11652 1.11790 1.11501 1.11618 45034 \n",
|
||||
"\n",
|
||||
" spread real_volume \n",
|
||||
"2 1 0 \n",
|
||||
"3 0 0 \n",
|
||||
"4 0 0 "
|
||||
"0.50097375"
|
||||
]
|
||||
},
|
||||
"execution_count": 30,
|
||||
"execution_count": 12,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"df.loc[2:6]"
|
||||
"# margin\n",
|
||||
"# worked for forex.\n",
|
||||
"tcs = 1 * sym.trade_contract_size\n",
|
||||
"lv = Account().leverage /0.125\n",
|
||||
"tcs * sym.tick.ask / lv"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": null,
|
||||
"id": "9307e3df-a5f3-42cf-9d3d-e65e5254c0e5",
|
||||
"id": "e8413f70-244f-47a2-97b3-2be6fcd87589",
|
||||
"metadata": {},
|
||||
"outputs": [],
|
||||
"source": [
|
||||
"now = datetime.now()\n",
|
||||
"st = now.replace(hour=0, minute=0, second=0, day=1, month=1, year=2023)\n",
|
||||
"et = now.replace(hour=9, minute=0, second=0)\n",
|
||||
"diff = et - st\n",
|
||||
"secs = int(diff.total_seconds())\n",
|
||||
"# st = now.replace(hour=0, day=16)\n",
|
||||
"# et = now.replace(hour=9)\n",
|
||||
"# start = now.replace(day=now.day-3, tzinfo=tz)\n",
|
||||
"# end = now.replace(day=now.day-1, tzinfo=tz)"
|
||||
]
|
||||
"source": []
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
@@ -658,7 +614,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.11.4"
|
||||
"version": "3.11.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
|
||||
Reference in New Issue
Block a user