Market

class Tribler.Core.Modules.restapi.market.asks_bids_endpoint.AsksEndpoint(session)[source]

This class handles requests regarding asks in the market community.

render_GET(request)[source]
GET /market/asks

A GET request to this endpoint will return all ask ticks in the order book of the market community.

Example request:

curl -X GET http://localhost:8085/market/asks

Example response:

{
    "asks": [{
        "asset1": "BTC",
        "asset2": "MB",
        "ticks": [{
            "trader_id": "12c406358ba05e5883a75da3f009477e4ca699a9",
            "timeout": 3600,
            "assets": {
                "first": {
                    "amount": 10,
                    "type": "BTC"
                },
                "second": {
                    "amount": 10,
                    "type": "MB"
                }
            },
            "traded": 5,
            "timestamp": 1493905920.68573,
            "order_number": 1}, ...]
    }, ...]
}
render_PUT(request)[source]
PUT /market/asks

A request to this endpoint will create a new ask order.

Example request:

curl -X PUT http://localhost:8085/market/asks --data
"first_asset_amount=10&second_asset_amount=10&first_asset_type=BTC&second_asset_type=MB"

Example response:

{
    "created": True
}
class Tribler.Core.Modules.restapi.market.asks_bids_endpoint.BaseAsksBidsEndpoint(session)[source]

This class acts as the base class for the asks/bids endpoint.

static create_ask_bid_from_params(parameters)[source]

Create an ask/bid from the provided parameters in a request. This method returns a tuple with the price, quantity and timeout of the ask/bid.

class Tribler.Core.Modules.restapi.market.asks_bids_endpoint.BidsEndpoint(session)[source]

This class handles requests regarding bids in the market community.

render_GET(request)[source]
GET /market/bids

A GET request to this endpoint will return all bid ticks in the order book of the market community.

Example request:

curl -X GET http://localhost:8085/market/bids

Example response:

{
    "bids": [{
        "asset1": "BTC",
        "asset2": "MB",
        "ticks": [{
            "trader_id": "12c406358ba05e5883a75da3f009477e4ca699a9",
            "timeout": 3600,
            "assets": {
                "first": {
                    "amount": 10,
                    "type": "BTC"
                },
                "second": {
                    "amount": 10,
                    "type": "MB"
                }
            },
            "traded": 5,
            "timestamp": 1493905920.68573,
            "order_number": 1}, ...]
    }, ...]
}
render_PUT(request)[source]
PUT /market/bids

A request to this endpoint will create a new bid order.

Example request:

curl -X PUT http://localhost:8085/market/bids --data
"first_asset_amount=10&second_asset_amount=10&first_asset_type=BTC&second_asset_type=MB"

Example response:

{
    "created": True
}
class Tribler.Core.Modules.restapi.market.orders_endpoint.OrderCancelEndpoint(session, order_number)[source]

This class handles requests for cancelling a specific order.

render_POST(request)[source]
GET /market/orders/(string: order_number)/cancel

A POST request to this endpoint will cancel a specific order.

Example request:

curl -X GET http://localhost:8085/market/orders/3/cancel

Example response:

{
    "cancelled": True
}
class Tribler.Core.Modules.restapi.market.orders_endpoint.OrderSpecificEndpoint(session, order_number)[source]
class Tribler.Core.Modules.restapi.market.orders_endpoint.OrdersEndpoint(session)[source]

This class handles requests regarding your orders in the market community.

render_GET(request)[source]
GET /market/orders

A GET request to this endpoint will return all your orders in the market community.

Example request:

curl -X GET http://localhost:8085/market/orders

Example response:

{
    "orders": [{
        "trader_id": "12c406358ba05e5883a75da3f009477e4ca699a9",
        "timestamp": 1493906434.627721,
        "assets" {
            "first": {
                "amount": 3,
                "type": "BTC",
            },
            "second": {
                "amount": 3,
                "type": "MB",
            }
        }
        "reserved_quantity": 0,
        "is_ask": False,
        "timeout": 3600,
        "traded": 0,
        "order_number": 1,
        "completed_timestamp": null,
        "cancelled": False,
        "status": "open"
    }]
}
class Tribler.Core.Modules.restapi.market.transactions_endpoint.TransactionPaymentsEndpoint(session, transaction_trader_id, transaction_number)[source]

This class handles requests for the payments of a specific transaction.

render_GET(request)[source]
GET /market/transactions/(string: trader_id)/(string: transaction_number)/payments

A GET request to this endpoint will return all payments tied to a specific transaction.

Example request:

curl -X GET http://localhost:8085/market/transactions/
12c406358ba05e5883a75da3f009477e4ca699a9/3/payments

Example response:

{
    "payments": [{
        "trader_id": "12c406358ba05e5883a75da3f009477e4ca699a9",
        "transaction_number": 3,
        "price": 10,
        "price_type": "MC",
        "quantity": 10,
        "quantity_type": "BTC",
        "transferred_quantity": 4,
        "payment_id": "abcd",
        "address_from": "my_mc_address",
        "address_to": "my_btc_address",
        "timestamp": 1493906434.627721,
    ]
}
class Tribler.Core.Modules.restapi.market.transactions_endpoint.TransactionSpecificNumberEndpoint(session, transaction_trader_id, path)[source]

This class handles requests for a transaction with a specific number.

class Tribler.Core.Modules.restapi.market.transactions_endpoint.TransactionSpecificTraderEndpoint(session, path)[source]

This class handles requests for a specific transaction.

class Tribler.Core.Modules.restapi.market.transactions_endpoint.TransactionsEndpoint(session)[source]

This class handles requests regarding (past) transactions in the market community.

render_GET(request)[source]
GET /market/transactions

A GET request to this endpoint will return all performed transactions in the market community.

Example request:

curl -X GET http://localhost:8085/market/transactions

Example response:

{
    "transactions": [{
        "trader_id": "12c406358ba05e5883a75da3f009477e4ca699a9",
        "order_number": 4,
        "partner_trader_id": "34c406358ba05e5883a75da3f009477e4ca699a9",
        "partner_order_number": 1,
        "transaction_number": 3,
        "assets" {
            "first": {
                "amount": 3,
                "type": "BTC",
            },
            "second": {
                "amount": 3,
                "type": "MB",
            }
        },
        "transferred" {
            "first": {
                "amount": 3,
                "type": "BTC",
            },
            "second": {
                "amount": 3,
                "type": "MB",
            }
        }
        "timestamp": 1493906434.627721,
        "payment_complete": False
    ]
}