Link

Off Exchange Settlements

  1. Copper will add a new section called Delegate funds, where clients can transfer part of their funds to the supported exchange.

  2. Suppose a client has 1000 BTC on his portfolio in Copper account.

  3. From the Delegate funds section client can transfer BTC to the exchange.

  4. Copper will then call the exchange’s API /add-funds with specified parameters:

     + POST [exchange-api-endpoint]/add-funds
        
     + Headers
       Authorization: Any Auth Scheme
        
     + Request
       {
         "requestId": "uniq-idempotency-key",
         "clientAccountId": "client-exchange-account-id",
         "amount": "200",
         "currency": "BTC"
       }
    

    Responses:

    200 OK ok
    200 OK requestId already exist and request params are the same (duplicate)
    400 Bad Request this requestId already exists but request params are not the same
    409 Conflict can’t process request (balance not available, etc.)
    4**5**                          any other error (timeout, service not available, etc.) — request will be retried after some delay
  5. Copper is able to call API, which will return funds back

     + POST [exchange-api-endpoint]/remove-funds
        
     + Headers
       Authorization: Any Auth Scheme
        
     + Request
       {
         "requestId": "uniq-idempotency-key",
         "clientAccountId": "client-exchange-account-id",
         "amount": "50",
         "currency": "BTC"
       }
    

    Responses:

    200 OK ok
    200 OK requestId already exist and request params are the same (duplicate)
    400 Bad Request this requestId already exists but request params are not the same
    409 Conflict can’t process request (balance not available, etc.)
    4**5**                          any other error (timeout, service not available, etc.) — request will be retried after some delay
  6. When the position is closed, exchange should send a request to the Copper for settlement.

     + POST https://api.copper.co/platfrom/orders
        
     + Headers
       Authorization: Any Auth Scheme
        
     + Request
       {
         "externalOrderId": "exchange-uniq-order-id",
         "portfolioId": "exchange-portfolio-id",   // exchange's account id in the Copper Platform, from which USD will be debited
         "orderType": "sell",     // or "buy"
         "limitType": "off-exchange",
         "baseCurrency": "BTC",
         "quoteCurrency": "USD",
         "amount": "10",
         "price": "7650.00",
         "clientAccountId": "client-exchange-account-id"
       }
    

    When this API method is called, Copper will check client-exchange-account-id has enough locked assets in favor of the exchange, debit funds from the client and top up exchange balance.