归还借贷
        :param order_id:
        :param amount:
        :return:
192907
def repay_loan(self, order_id, amount):
        
        params = {'order-id': order_id, 'amount': amount}
        path = f'/v1/margin/orders/{order_id}/repay'

        def _wrapper(_func):
            @wraps(_func)
            def handle():
                _func(api_key_post(params, path))

            return handle

        return _wrapper
695190
def ethinca_order_from_string(order):
    
    if order in get_ethinca_orders().keys():
        return get_ethinca_orders()[order]
    else: raise ValueError("Order "+str(order)+" is not valid for ethinca"
                           "calculation! Valid orders: "+
                           str(get_ethinca_orders().keys()))
1206538
def placeOrder(self, contract, order, orderId=None, account=None):
        

        # get latest order id before submitting an order
        self.requestOrderIds()

        # continue...
        useOrderId = self.orderId if orderId == None else orderId
        if account:
            order.m_account = account
        self.ibConn.placeOrder(useOrderId, contract, order)

        account_key = order.m_account
        self.orders[useOrderId] = {
            "id":       useOrderId,
            "symbol":   self.contractString(contract),
            "contract": contract,
            "status":   "SENT",
            "reason":   None,
            "avgFillPrice": 0.,
            "parentId": 0,
            "time": datetime.fromtimestamp(int(self.time)),
            "account": None
        }
        if hasattr(order, "m_account"):
            self.orders[useOrderId]["account"] = order.m_account

        # return order id
        return useOrderId
1330271
public static LimitOrder adaptOrder(
      BigDecimal amount,
      BigDecimal price,
      CurrencyPair currencyPair,
      OrderType orderType,
      String id) {

    return new LimitOrder(orderType, amount, currencyPair, id, null, price);
  }
745908
def create_payment(self, data):
        
        return OrderPayments(self.client).on(self).create(data)
296389
def delete_order(self, order_id):
        
        payload = {
            "request": "/v1/order/cancel",
            "nonce": self._nonce,
            "order_id": order_id
        }

        signed_payload = self._sign_payload(payload)
        r = requests.post(self.URL + "/order/cancel", headers=signed_payload, verify=True)
        json_resp = r.json()

        try:
            json_resp['avg_execution_price']
        except:
            return json_resp['message']

        return json_resp
545795
function _doRefund($oID, $amount = 0) {
    global $db, $messageStack;
    $_POST['refamt'] = preg_replace('/[^0-9.%]/', '', $_POST['refamt']);
    $new_order_status = (int)MODULE_PAYMENT_LINKPOINT_API_REFUNDED_ORDER_STATUS_ID;
    if ($new_order_status == 0) $new_order_status = 1;
    $proceedToRefund = true;
    $refundNote = strip_tags(zen_db_input($_POST['refnote']));
    if (isset($_POST['refconfirm']) && $_POST['refconfirm'] != 'on') {
      $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_REFUND_CONFIRM_ERROR, 'error');
      $proceedToRefund = false;
    }
    if (isset($_POST['buttonrefund']) && $_POST['buttonrefund'] == MODULE_PAYMENT_LINKPOINT_API_ENTRY_REFUND_BUTTON_TEXT) {
      $refundAmt = (float)$_POST['refamt'];
      $new_order_status = (int)MODULE_PAYMENT_LINKPOINT_API_REFUNDED_ORDER_STATUS_ID;
      if ($refundAmt == 0) {
        $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_INVALID_REFUND_AMOUNT, 'error');
        $proceedToRefund = false;
      }
    }
    if (isset($_POST['cc_number']) && (int)trim($_POST['cc_number']) == 0) {
      $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_CC_NUM_REQUIRED_ERROR, 'error');
    }
    if (isset($_POST['trans_id']) && (int)trim($_POST['trans_id']) == 0) {
      $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_TRANS_ID_REQUIRED_ERROR, 'error');
      $proceedToRefund = false;
    }

    $sql = "select lp_trans_num, transaction_time from " . TABLE_LINKPOINT_API . " where order_id = " . (int)$oID . " and transaction_result = 'APPROVED' order by transaction_time DESC";
    $query = $db->Execute($sql);
    if ($query->RecordCount() < 1) {
      $messageStack->add_session(MODULE_PAYMENT_LINKPOINT_API_TEXT_NO_MATCHING_ORDER_FOUND, 'error');
      $proceedToRefund = false;
    }
    /**
     * Submit refund request to gateway
     */
    if ($proceedToRefund) {
      unset($myorder);
      $myorder["ordertype"] = 'CREDIT';
      $myorder["oid"] = $query->fields['lp_trans_num'];
      if ($_POST['trans_id'] != '') $myorder["tdate"] = $_POST['trans_id'];
      $myorder["chargetotal"] = number_format($refundAmt, 2, '.', '');
      $myorder["comments"]  = htmlentities($refundNote, ENT_QUOTES, 'UTF-8');

      $result = $this->_sendRequest($myorder);
      $response_alert = $result['r_approved'] . ' ' . $result['r_error'] . ($this->commError == '' ? '' : ' Communications Error - Please notify webmaster.');
      $this->reportable_submit_data['Note'] = $refundNote;
      $failure = ($result["r_approved"] != "APPROVED");
      if ($failure) {
        $messageStack->add_session($response_alert, 'error');
      } else {
        // Success, so save the results
        $this->_updateOrderStatus($oID, $new_order_status, 'REFUND INITIATED. Order ID:' . $result['r_ordernum'] . ' - ' . 'Trans ID: ' . $result['r_tdate'] . "\n" . 'Amount: ' . $myorder["chargetotal"] . "\n" . $refundNote);
        $messageStack->add_session(sprintf(MODULE_PAYMENT_LINKPOINT_API_TEXT_REFUND_INITIATED, $result['r_tdate'], $result['r_ordernum']), 'success');
        return true;
      }
    }
    return false;
  }
966990
public OvhPaymentMeans order_orderId_paymentMeans_GET(Long orderId) throws IOException {
		String qPath = "/me/order/{orderId}/paymentMeans";
		StringBuilder sb = path(qPath, orderId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhPaymentMeans.class);
	}
1310466
def status_for_order(self, order_id, stock):
        
        url_fragment = 'venues/{venue}/stocks/{stock}/orders/{order_id}'.format(
            venue=self.venue,
            stock=stock,
            order_id=order_id,
        )
        url = urljoin(self.base_url, url_fragment)
        return self.session.get(url).json()
246702
def lookup_order(self, order_id):
        
        self._log('look up order(s) {}'.format(order_id))
        return self._rest_client.post(
            endpoint='/lookup_order',
            payload={'id': order_id}
        )
692683
public void order_orderId_pay_POST(Long orderId, OvhPayWithPaymentMethod paymentMethod) throws IOException {
		String qPath = "/me/order/{orderId}/pay";
		StringBuilder sb = path(qPath, orderId);
		HashMap<String, Object>o = new HashMap<String, Object>();
		addBody(o, "paymentMethod", paymentMethod);
		exec(qPath, "POST", sb.toString(), o);
	}
1259752
def batchcancel_order(self, order_ids: list):
        
        assert isinstance(order_ids, list)
        params = {'order-ids': order_ids}
        path = f'/v1/order/orders/batchcancel'

        def _wrapper(_func):
            @wraps(_func)
            def handle():
                _func(api_key_post(params, path))

            return handle

        return _wrapper
944618
def cancel_order(self, order_id):
        
        request = '/v1/order/cancel'
        url = self.base_url + request
        params = {
            'request': request,
            'nonce': self.get_nonce(),
            'order_id': order_id
        }

        return requests.post(url, headers=self.prepare(params))
413268
def fetch(self, payment_id, data={}, **kwargs):
        "
        return super(Payment, self).fetch(payment_id, data, **kwargs)
1182411
def list_orders(self, params=None):
        """"""
        request = self._get('transactions/orders', params)
        return self.responder(request)
575839
public OvhPayment order_orderId_payment_GET(Long orderId) throws IOException {
		String qPath = "/me/order/{orderId}/payment";
		StringBuilder sb = path(qPath, orderId);
		String resp = exec(qPath, "GET", sb.toString(), null);
		return convertTo(resp, OvhPayment.class);
	}
532786
def get_order(self, order_id, **params):
        """"""
        response = self._get('v2', 'orders', order_id, params=params)
        return self._make_api_object(response, Order)