-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
ff8ee83
commit dfa3b10
Showing
2 changed files
with
54 additions
and
0 deletions.
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,26 @@ | ||
import os | ||
import sys | ||
import asyncio | ||
|
||
|
||
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
sys.path.append(root) | ||
|
||
from binance.client import Client | ||
|
||
## create order using websockets sync | ||
## the API is very similar to the REST API | ||
|
||
def main(): | ||
api_key = "" # your api_key here | ||
secret = "" # your secret here | ||
client = Client(api_key, secret, testnet=True) | ||
order = client.ws_create_order( | ||
symbol="LTCUSDT", | ||
side="BUY", | ||
type="MARKET", | ||
quantity=0.1, | ||
) | ||
print(order['orderId']) | ||
|
||
main() |
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,28 @@ | ||
import os | ||
import sys | ||
import asyncio | ||
|
||
|
||
root = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
sys.path.append(root) | ||
|
||
from binance import AsyncClient | ||
|
||
## create order using websockets async | ||
## the API is very similar to the REST API | ||
|
||
async def main(): | ||
api_key = "" # your api_key here | ||
secret = "" # your secret here | ||
client = AsyncClient(api_key, secret, testnet=True) | ||
order = await client.ws_create_order( | ||
symbol="LTCUSDT", | ||
side="BUY", | ||
type="MARKET", | ||
quantity=0.1, | ||
) | ||
print(order['orderId']) | ||
await client.close_connection() | ||
|
||
|
||
asyncio.run(main()) |