Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(py): DESK action provider #588

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

chenciao8
Copy link

Description

Add TradeOnDESK functionality which including:

  • Getting platform information
  • Getting user's data on platform
  • Deposit and Withdraw Collateral to platform
  • Trade on platform

Tests

Chatbot: python/examples/langchain-desk-chatbot/chatbot.py
Network: Arbitrum Sepolia
Setup: EVM Wallet with TestUSDC and Gas in wallet

Get account info on DESK

Prompt:

get my info on desk

Output:

Here is your current information on the desk:

### Collaterals
- **Asset**: USDC
- **Amount**: 22,581.56

### Positions
1. **Symbol**: VIRTUALUSD
   - **Quantity**: 1,340.20
   - **Average Entry Price**: 1.1028
   - **Side**: Short
   - **Last Updated Funding Fee**: 0.2676

2. **Symbol**: KAITOUSD
   - **Quantity**: 1,991.80
   - **Average Entry Price**: 1.4025
   - **Side**: Short
   - **Last Updated Funding Fee**: 0.0515

### Account Summary
- **Account Margin**: 23,879.59
- **Collateral Value**: 22,581.06
- **Unrealized P&L**: 509.28
- **Pending Funding Fee**: -789.25
- **Pending Borrowing Fee**: -0.0000000014
- **Account IMR**: 1,226.68
- **Order IMR**: 0.00
- **Position IMR**: 1,226.68
- **Position MMR**: 390.20

Place market order on DESK

Prompt:

market long btcusd for 0.01

Output:

Your market order to long **0.01 BTCUSD** has been successfully placed. Here are the details:

- **Subaccount**: 0x0123456789012345678901234567890123456789000000000000000000000001
- **Side**: Long
- **Order Type**: Market
- **Filled Quantity**: 0.01 BTC
- **Average Fill Price**: 82,969.00
- **Execution Fee**: 0.01
- **Order Digest**: 0x0000000000000000000000000000000000000000000000000000000000000001

Deposit collateral on DESK

Prompt:

deposit 10 usdc

Output:

Your deposit of **10 USDC** has been successfully completed. Here is the transaction hash for your reference:

- **Transaction Hash**: 0123456789012345678901234567890123456789012345678901234567890123

Checklist

A couple of things to include in your PR for completeness:

  • Added documentation to all relevant README.md files
  • Added a changelog entry

* feat: functionality

* chore: refactor

* chore: test

* chore: refactor example and lock desk sdk version

* chore: lint and format

* chore: upgrade sdk version, refactor and comment

* chore: changelog

* chore: comment

* chore: changelog

* chore: comment

* chore: changelog

---------

Signed-off-by: chenciao8 <[email protected]>
@chenciao8 chenciao8 requested a review from murrlincoln as a code owner March 19, 2025 07:06
@cb-heimdall
Copy link

🟡 Heimdall Review Status

Requirement Status More Info
Reviews 🟡 0/1
Denominator calculation
Show calculation
1 if user is bot 0
1 if user is external 0
From .codeflow.yml 1
Additional review requirements
Show calculation
Max 0
0
From CODEOWNERS 0
Global minimum 0
Max 1
1
1 if commit is unverified 0
Sum 1

@github-actions github-actions bot added documentation Improvements or additions to documentation action provider New action provider example New example agent python labels Mar 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
action provider New action provider documentation Improvements or additions to documentation example New example agent python
Development

Successfully merging this pull request may close these issues.

2 participants