Skip to content

Instantly share code, notes, and snippets.

@sfat
Created August 30, 2022 06:15
Show Gist options
  • Select an option

  • Save sfat/e8d06cb5f9d7a1e4c4b141fd5a2f01d2 to your computer and use it in GitHub Desktop.

Select an option

Save sfat/e8d06cb5f9d7a1e4c4b141fd5a2f01d2 to your computer and use it in GitHub Desktop.

Revisions

  1. sfat created this gist Aug 30, 2022.
    12 changes: 12 additions & 0 deletions make_binance_order.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    #!/usr/bin/env bash
    timestamp=$(python3 -c 'import time; print(int(time.time() * 1000))')
    api_key="API_KEY" # change me
    secret_key="SECRET_KEY" # change me
    query="symbol=$1&side=$2&type=MARKET&quantity=$3&recvWindow=10000&timestamp=$timestamp"
    echo "$query"
    signature=$(echo -n "$query" | openssl dgst -sha256 -hmac $secret_key)
    #echo -n "$query"

    echo "$signature"
    echo "https://testnet.binance.vision/api/v3/order?$query&signature=$signature"
    curl -vvv -H "X-MBX-APIKEY: $api_key" -X POST "https://testnet.binance.vision/api/v3/order?$query&signature=$signature"