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

Deribit: createOrder, USDC Swap #16139

Merged
merged 1 commit into from Dec 20, 2022

Conversation

Dan-krm
Copy link
Contributor

@Dan-krm Dan-krm commented Dec 20, 2022

Added support for linear USDC settled swaps:
fixes: #16073

node examples/js/cli deribit createOrder LINK/USDC:USDC market buy 1

deribit.createOrder (LINK/USDC:USDC, market, buy, 1)
2022-12-20T05:22:05.316Z iteration 0 passed in 195 ms

{
  info: {
    web: false,
    time_in_force: 'good_til_cancelled',
    risk_reducing: false,
    replaced: false,
    reduce_only: false,
    profit_loss: '0.0',
    price: '6.121',
    post_only: false,
    order_type: 'market',
    order_state: 'filled',
    order_id: 'USDC-3570684930',
    mmp: false,
    max_show: '1.0',
    last_update_timestamp: '1671513728033',
    label: '',
    is_liquidation: false,
    instrument_name: 'LINK_USDC-PERPETUAL',
    filled_amount: '1.0',
    direction: 'buy',
    creation_timestamp: '1671513728033',
    commission: '0.0030145',
    average_price: '6.029',
    api: true,
    amount: '1.0',
    trades: [
      {
        trade_seq: '58742',
        trade_id: 'USDC-6634134',
        timestamp: '1671513728033',
        tick_direction: '0',
        state: 'filled',
        self_trade: false,
        risk_reducing: false,
        reduce_only: false,
        profit_loss: '0.0',
        price: '6.029',
        post_only: false,
        order_type: 'market',
        order_id: 'USDC-3570684930',
        mmp: false,
        matching_id: null,
        mark_price: '6.0308',
        liquidity: 'T',
        instrument_name: 'LINK_USDC-PERPETUAL',
        index_price: '6.0377',
        fee_currency: 'USDC',
        fee: '0.0030145',
        direction: 'buy',
        api: true,
        amount: '1.0'
      }
    ]
  },
  id: 'USDC-3570684930',
  clientOrderId: undefined,
  timestamp: 1671513728033,
  datetime: '2022-12-20T05:22:08.033Z',
  lastTradeTimestamp: 1671513728033,
  symbol: 'LINK/USDC:USDC',
  type: 'market',
  timeInForce: 'GTC',
  postOnly: false,
  side: 'buy',
  price: 6.121,
  stopPrice: undefined,
  amount: 1,
  cost: 6.029,
  average: 6.029,
  filled: 1,
  remaining: 0,
  status: 'closed',
  fee: { cost: '0.0030145', currency: 'LINK' },
  trades: [
    {
      id: 'USDC-6634134',
      info: {
        trade_seq: '58742',
        trade_id: 'USDC-6634134',
        timestamp: '1671513728033',
        tick_direction: '0',
        state: 'filled',
        self_trade: false,
        risk_reducing: false,
        reduce_only: false,
        profit_loss: '0.0',
        price: '6.029',
        post_only: false,
        order_type: 'market',
        order_id: 'USDC-3570684930',
        mmp: false,
        matching_id: null,
        mark_price: '6.0308',
        liquidity: 'T',
        instrument_name: 'LINK_USDC-PERPETUAL',
        index_price: '6.0377',
        fee_currency: 'USDC',
        fee: '0.0030145',
        direction: 'buy',
        api: true,
        amount: '1.0'
      },
      timestamp: 1671513728033,
      datetime: '2022-12-20T05:22:08.033Z',
      symbol: 'LINK/USDC:USDC',
      order: 'USDC-3570684930',
      type: 'market',
      side: 'buy',
      takerOrMaker: 'taker',
      price: 6.029,
      amount: 1,
      cost: 6.029,
      fee: { cost: 0.0030145, currency: 'USDC' },
      fees: [ { currency: 'USDC', cost: '0.0030145' } ]
    }
  ],
  fees: [ { currency: 'USDC', cost: 0.0030145 } ]
}

Added support for linear USDC settled swaps:
```
node examples/js/cli deribit createOrder LINK/USDC:USDC market buy 1

deribit.createOrder (LINK/USDC:USDC, market, buy, 1)
2022-12-20T05:22:05.316Z iteration 0 passed in 195 ms

{
  info: {
    web: false,
    time_in_force: 'good_til_cancelled',
    risk_reducing: false,
    replaced: false,
    reduce_only: false,
    profit_loss: '0.0',
    price: '6.121',
    post_only: false,
    order_type: 'market',
    order_state: 'filled',
    order_id: 'USDC-3570684930',
    mmp: false,
    max_show: '1.0',
    last_update_timestamp: '1671513728033',
    label: '',
    is_liquidation: false,
    instrument_name: 'LINK_USDC-PERPETUAL',
    filled_amount: '1.0',
    direction: 'buy',
    creation_timestamp: '1671513728033',
    commission: '0.0030145',
    average_price: '6.029',
    api: true,
    amount: '1.0',
    trades: [
      {
        trade_seq: '58742',
        trade_id: 'USDC-6634134',
        timestamp: '1671513728033',
        tick_direction: '0',
        state: 'filled',
        self_trade: false,
        risk_reducing: false,
        reduce_only: false,
        profit_loss: '0.0',
        price: '6.029',
        post_only: false,
        order_type: 'market',
        order_id: 'USDC-3570684930',
        mmp: false,
        matching_id: null,
        mark_price: '6.0308',
        liquidity: 'T',
        instrument_name: 'LINK_USDC-PERPETUAL',
        index_price: '6.0377',
        fee_currency: 'USDC',
        fee: '0.0030145',
        direction: 'buy',
        api: true,
        amount: '1.0'
      }
    ]
  },
  id: 'USDC-3570684930',
  clientOrderId: undefined,
  timestamp: 1671513728033,
  datetime: '2022-12-20T05:22:08.033Z',
  lastTradeTimestamp: 1671513728033,
  symbol: 'LINK/USDC:USDC',
  type: 'market',
  timeInForce: 'GTC',
  postOnly: false,
  side: 'buy',
  price: 6.121,
  stopPrice: undefined,
  amount: 1,
  cost: 6.029,
  average: 6.029,
  filled: 1,
  remaining: 0,
  status: 'closed',
  fee: { cost: '0.0030145', currency: 'LINK' },
  trades: [
    {
      id: 'USDC-6634134',
      info: {
        trade_seq: '58742',
        trade_id: 'USDC-6634134',
        timestamp: '1671513728033',
        tick_direction: '0',
        state: 'filled',
        self_trade: false,
        risk_reducing: false,
        reduce_only: false,
        profit_loss: '0.0',
        price: '6.029',
        post_only: false,
        order_type: 'market',
        order_id: 'USDC-3570684930',
        mmp: false,
        matching_id: null,
        mark_price: '6.0308',
        liquidity: 'T',
        instrument_name: 'LINK_USDC-PERPETUAL',
        index_price: '6.0377',
        fee_currency: 'USDC',
        fee: '0.0030145',
        direction: 'buy',
        api: true,
        amount: '1.0'
      },
      timestamp: 1671513728033,
      datetime: '2022-12-20T05:22:08.033Z',
      symbol: 'LINK/USDC:USDC',
      order: 'USDC-3570684930',
      type: 'market',
      side: 'buy',
      takerOrMaker: 'taker',
      price: 6.029,
      amount: 1,
      cost: 6.029,
      fee: { cost: 0.0030145, currency: 'USDC' },
      fees: [ { currency: 'USDC', cost: '0.0030145' } ]
    }
  ],
  fees: [ { currency: 'USDC', cost: 0.0030145 } ]
}
```
@carlosmiei
Copy link
Collaborator

LGTM ✅

@carlosmiei carlosmiei self-assigned this Dec 20, 2022
@kroitor kroitor merged commit 60d6ae1 into ccxt:master Dec 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Deribit Issue with USDC Perp contract order
3 participants