Skip to content

Commit 2a45991

Browse files
committed
Update to 28.0.6
1 parent 231db3d commit 2a45991

13 files changed

Lines changed: 175 additions & 13 deletions

README.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ MetaApi is a powerful, fast, cost-efficient, easy to use and standards-driven cl
55

66
CopyFactory is a simple yet powerful copy-trading API which is a part of MetaApi. See below for CopyFactory readme section.
77

8-
MetaApi is a paid service, however we offer a free tier for testing and personal use.
8+
MetaApi is a paid service, however we may offer a free tier access in some cases.
99

1010
The `MetaApi pricing <https://metaapi.cloud/#pricing>`_ was developed with the intent to make your charges less or equal to what you would have to pay
1111
for hosting your own infrastructure. This is possible because over time we managed to heavily optimize

changelog.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
1+
28.0.6
2+
- fix latency reservoir calculations
3+
4+
28.0.5
5+
- improve risk management tracking period docs
6+
- added pending order expiration examples and docs
7+
8+
28.0.4
9+
- fix `comment` and `clientId` descriptions
10+
- fix `MetatraderSymbolSpecification.fillingModes` field name and description
11+
- fix `MetatraderSymbolSpecification.hedgedMargin` to be optional
12+
- fix `MetatraderSymbolSpecification.orderGTCMode` to be optional
13+
- fix `MetatraderAccountInformation.accountCurrencyExchangeRate` updates in `TerminalState`
14+
115
28.0.3
216
- added date conversion error logging
317

docs/metaApi/rpcApi.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,48 @@ same time. You can find the full description here:
155155
}
156156
}
157157
}))
158+
159+
Order expiration
160+
^^^^^^^^^^^^^^^^
161+
Order expiration is a trade option that allows you to automatically cancel old pending orders. By default orders have
162+
the expiration type ``ORDER_TIME_GTC``, which means they won't be canceled until the user's request. ``ORDER_TIME_DAY``
163+
means the order will be canceled at the end of the current trade day; ``ORDER_TIME_SPECIFIED`` means the order will be
164+
canceled at a specified time; ``ORDER_TIME_SPECIFIED_DAY`` means the order will be canceled at the end of the specified
165+
trade day. MetaTrader 4 supports only ``ORDER_TIME_GTC`` and ``ORDER_TIME_SPECIFIED``.
166+
You can find the full description here:
167+
`https://metaapi.cloud/docs/client/restApi/api/trade/#pending-order-expiration-settings <https://metaapi.cloud/docs/client/restApi/api/trade/#pending-order-expiration-settings>`_
168+
169+
.. code-block:: python
170+
171+
# without specified options, ORDER_TIME_GTC is applied
172+
print(await connection.create_limit_buy_order('GBPUSD', 0.07, 1.0, 0.9, 2.0))
173+
174+
# specified expiration time
175+
print(await connection.create_limit_buy_order(
176+
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {
177+
'expiration': {
178+
'type': 'ORDER_TIME_SPECIFIED',
179+
'time': datetime.now() + timedelta(days=1)
180+
}
181+
}
182+
))
183+
184+
# specified expiration date
185+
print(await connection.create_limit_buy_order(
186+
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {
187+
'expiration': {
188+
'type': 'ORDER_TIME_SPECIFIED_DAY',
189+
'time': datetime.now() + timedelta(days=1)
190+
}
191+
}
192+
))
193+
194+
# expires at the end of the current day
195+
print(await connection.create_limit_buy_order(
196+
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {
197+
'expiration': {
198+
'type': 'ORDER_TIME_SPECIFIED_DAY',
199+
'time': datetime.now() + timedelta(days=1)
200+
}
201+
}
202+
))

docs/metaApi/streamingApi.rst

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,51 @@ same time. You can find the full description here:
206206
}
207207
}))
208208
209+
Order expiration
210+
^^^^^^^^^^^^^^^^
211+
Order expiration is a trade option that allows you to automatically cancel old pending orders. By default orders have
212+
the expiration type ``ORDER_TIME_GTC``, which means they won't be canceled until the user's request. ``ORDER_TIME_DAY``
213+
means the order will be canceled at the end of the current trade day; ``ORDER_TIME_SPECIFIED`` means the order will be
214+
canceled at a specified time; ``ORDER_TIME_SPECIFIED_DAY`` means the order will be canceled at the end of the specified
215+
trade day. MetaTrader 4 supports only ``ORDER_TIME_GTC`` and ``ORDER_TIME_SPECIFIED``.
216+
You can find the full description here:
217+
`https://metaapi.cloud/docs/client/restApi/api/trade/#pending-order-expiration-settings <https://metaapi.cloud/docs/client/restApi/api/trade/#pending-order-expiration-settings>`_
218+
219+
.. code-block:: python
220+
221+
# without specified options, ORDER_TIME_GTC is applied
222+
print(await connection.create_limit_buy_order('GBPUSD', 0.07, 1.0, 0.9, 2.0))
223+
224+
# specified expiration time
225+
print(await connection.create_limit_buy_order(
226+
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {
227+
'expiration': {
228+
'type': 'ORDER_TIME_SPECIFIED',
229+
'time': datetime.now() + timedelta(days=1)
230+
}
231+
}
232+
))
233+
234+
# specified expiration date
235+
print(await connection.create_limit_buy_order(
236+
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {
237+
'expiration': {
238+
'type': 'ORDER_TIME_SPECIFIED_DAY',
239+
'time': datetime.now() + timedelta(days=1)
240+
}
241+
}
242+
))
243+
244+
# expires at the end of the current day
245+
print(await connection.create_limit_buy_order(
246+
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {
247+
'expiration': {
248+
'type': 'ORDER_TIME_SPECIFIED_DAY',
249+
'time': datetime.now() + timedelta(days=1)
250+
}
251+
}
252+
))
253+
209254
Monitoring account connection health and uptime
210255
===============================================
211256
You can monitor account connection health using MetaApiConnection.health_monitor API.

docs/riskManagement.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ which have to enforce trading risk restrictions.
88
MetaApi risk management API is a member of MetaApi project (`https://metaapi.cloud <https://metaapi.cloud>`_),
99
a powerful cloud forex trading API which supports both MetaTrader 4 and MetaTrader 5 platforms.
1010

11-
MetaApi is a paid service, however API access to one MetaTrader account is free of charge.
11+
MetaApi is a paid service, however we may offer a free tier access in some cases.
1212

1313
The `MetaApi pricing <https://metaapi.cloud/#pricing>`_ was developed with the intent to make your charges less or equal
1414
to what you would have to pay for hosting your own infrastructure. This is possible because over time we managed to heavily

examples/example_generator/rpc_example.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,14 @@ async def test_meta_api_synchronization():
6767
print('Submitting pending order')
6868
try:
6969
result = await connection.create_limit_buy_order(
70-
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {'comment': 'comm', 'clientId': 'TE_GBPUSD_7hyINWqAlE'}
70+
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {
71+
'comment': 'comm',
72+
'clientId': 'TE_GBPUSD_7hyINWqAlE',
73+
'expiration': {
74+
'type': 'ORDER_TIME_SPECIFIED',
75+
'time': datetime.now() + timedelta(days=1)
76+
}
77+
}
7178
)
7279
print('Trade successful, result code is ' + result['stringCode'])
7380
except Exception as err:

examples/example_generator/synchronization_example.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import asyncio
33
from metaapi_cloud_sdk import MetaApi
4-
from datetime import datetime
4+
from datetime import datetime, timedelta
55

66
# Note: for information on how to use this example code please read https://metaapi.cloud/docs/client/usingCodeExamples
77

@@ -79,7 +79,14 @@ async def test_meta_api_synchronization():
7979
print('Submitting pending order')
8080
try:
8181
result = await connection.create_limit_buy_order(
82-
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {'comment': 'comm', 'clientId': 'TE_GBPUSD_7hyINWqAlE'}
82+
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {
83+
'comment': 'comm',
84+
'clientId': 'TE_GBPUSD_7hyINWqAlE',
85+
'expiration': {
86+
'type': 'ORDER_TIME_SPECIFIED',
87+
'time': datetime.now() + timedelta(days=1)
88+
}
89+
}
8390
)
8491
print('Trade successful, result code is ' + result['stringCode'])
8592
except Exception as err:

examples/mt4/provisioning_profile.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import os
22
import asyncio
33
from metaapi_cloud_sdk import MetaApi
4+
from datetime import datetime, timedelta
45

56
# Note: for information on how to use this example code please read https://metaapi.cloud/docs/client/usingCodeExamples/
67
# It is recommended to create accounts with automatic broker settings detection instead,
@@ -96,7 +97,14 @@ async def meta_api_synchronization():
9697
print('Submitting pending order')
9798
try:
9899
result = await connection.create_limit_buy_order(
99-
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {'comment': 'comm', 'clientId': 'TE_GBPUSD_7hyINWqAlE'}
100+
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {
101+
'comment': 'comm',
102+
'clientId': 'TE_GBPUSD_7hyINWqAlE',
103+
'expiration': {
104+
'type': 'ORDER_TIME_SPECIFIED',
105+
'time': datetime.now() + timedelta(days=1)
106+
}
107+
}
100108
)
101109
print('Trade successful, result code is ' + result['stringCode'])
102110
except Exception as err:

examples/mt4/real_time_streaming.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import os
22
import asyncio
33
from metaapi_cloud_sdk import MetaApi
4-
from datetime import datetime
4+
from datetime import datetime, timedelta
55

66
# Note: for information on how to use this example code please read https://metaapi.cloud/docs/client/usingCodeExamples/
77

@@ -99,7 +99,14 @@ async def meta_api_synchronization():
9999
print('Submitting pending order')
100100
try:
101101
result = await connection.create_limit_buy_order(
102-
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {'comment': 'comm', 'clientId': 'TE_GBPUSD_7hyINWqAlE'}
102+
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {
103+
'comment': 'comm',
104+
'clientId': 'TE_GBPUSD_7hyINWqAlE',
105+
'expiration': {
106+
'type': 'ORDER_TIME_SPECIFIED',
107+
'time': datetime.now() + timedelta(days=1)
108+
}
109+
}
103110
)
104111
print('Trade successful, result code is ' + result['stringCode'])
105112
except Exception as err:

examples/mt4/rpc.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,14 @@ async def meta_api_synchronization():
8787
print('Submitting pending order')
8888
try:
8989
result = await connection.create_limit_buy_order(
90-
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {'comment': 'comm', 'clientId': 'TE_GBPUSD_7hyINWqAlE'}
90+
'GBPUSD', 0.07, 1.0, 0.9, 2.0, {
91+
'comment': 'comm',
92+
'clientId': 'TE_GBPUSD_7hyINWqAlE',
93+
'expiration': {
94+
'type': 'ORDER_TIME_SPECIFIED',
95+
'time': datetime.now() + timedelta(days=1)
96+
}
97+
}
9198
)
9299
print('Trade successful, result code is ' + result['stringCode'])
93100
except Exception as err:

0 commit comments

Comments
 (0)