{ "cells": [ { "cell_type": "code", "execution_count": 2, "id": "b6c46d40", "metadata": {}, "outputs": [], "source": [ "import modules.apex_api as apex_api" ] }, { "cell_type": "code", "execution_count": 4, "id": "7fb6d9dc", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Authenticating...\n", "...Authenticated\n" ] } ], "source": [ "client = apex_api.apex_create_client()" ] }, { "cell_type": "code", "execution_count": 5, "id": "d5a1203a", "metadata": {}, "outputs": [], "source": [ "# print(\"*** POSTING ORDER ***\")\n", "# createOrderRes = client.create_order_v3(\n", "# symbol=\"ETH-USDT\", \n", "# side=\"BUY\",\n", "# type=\"LIMIT\",\n", "# size=\"0.01\",\n", "# price=\"2100\",\n", "# )\n", "# print(createOrderRes)\n" ] }, { "cell_type": "code", "execution_count": null, "id": "c21254eb", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'data': {'totalEquityValue': '13.840000000000000000',\n", " 'availableBalance': '13.840000000000000000',\n", " 'initialMargin': '0',\n", " 'maintenanceMargin': '0',\n", " 'walletBalance': '',\n", " 'realizedPnl': '-5.399416243793950000',\n", " 'unrealizedPnl': '0.00',\n", " 'totalRisk': '0',\n", " 'totalValueWithoutDiscount': '13.840000000000000000',\n", " 'liabilities': '13.840000000000000000',\n", " 'totalAvailableBalance': '13.840000000000000000'},\n", " 'timeCost': 6327944}" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "client.get_account_balance_v3()" ] }, { "cell_type": "code", "execution_count": 8, "id": "7cba63d4", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'data': [], 'timeCost': 3984811}" ] }, "execution_count": 8, "metadata": {}, "output_type": "execute_result" } ], "source": [ "client.open_orders_v3()" ] }, { "cell_type": "code", "execution_count": 12, "id": "b072c0de", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'timeCost': 4389124}" ] }, "execution_count": 12, "metadata": {}, "output_type": "execute_result" } ], "source": [ "client.delete_open_orders_v3(symbol=\"ETH-USDT\")" ] }, { "cell_type": "code", "execution_count": 11, "id": "5ea177f8", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "TOKEN: USDT == 13.840000000000000000\n", "TOKEN: USDC == 0.000000000000000000\n" ] } ], "source": [ "account_and_pos = client.get_account_v3()\n", "for c in account_and_pos['contractWallets']:\n", " print(f'TOKEN: {c['token']} == {c['balance']}')" ] }, { "cell_type": "code", "execution_count": null, "id": "70eb3b4f", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "fefca500", "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "code", "execution_count": null, "id": "dc048386", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "py_313", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.13.12" } }, "nbformat": 4, "nbformat_minor": 5 }