-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added creating_dataframe and creating_orders to ./perftests
- Loading branch information
1 parent
073d766
commit 27792c9
Showing
3 changed files
with
42 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import asyncio | ||
from perftests.helpers import Time, client | ||
|
||
|
||
print('Running creating_dataframes benchmark with async_v20 version', client.version) | ||
loop = asyncio.get_event_loop() | ||
|
||
rsp = loop.run_until_complete(client.get_candles('AUD_USD')) | ||
|
||
|
||
with Time() as t: | ||
for _ in range(1000): | ||
df = rsp.candles.dataframe() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import asyncio | ||
from perftests.helpers import Time, client | ||
|
||
|
||
print('Running creating_dataframe benchmark with async_v20 version', client.version) | ||
loop = asyncio.get_event_loop() | ||
|
||
# This will test the speed of the _formatting_order_requests helper function | ||
client.format_order_requests = True | ||
|
||
async def place_orders(count): | ||
await asyncio.gather(*[ | ||
client.create_order( | ||
'AUD_USD', | ||
units=0, | ||
stop_loss_on_fill=0, | ||
take_profit_on_fill=0, | ||
trailing_stop_loss_on_fill=0, | ||
) | ||
for _ in range(count)]) | ||
|
||
|
||
with Time() as t: | ||
for _ in range(10): | ||
loop.run_until_complete(place_orders(500)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters