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": [{
        "price_type": "BTC",
        "quantity_type": "MC",
        "ticks": [{
            "trader_id": "12c406358ba05e5883a75da3f009477e4ca699a9",
            "timeout": 3600,
            "quantity_type": "MC",
            "price_type": "BTC",
            "timestamp": 1493905920.68573,
            "price": 10.0,
            "order_number": 1,
            "message_id": "12c406358ba05e5883a75da3f009477e4ca699a9.1",
            "quantity": 10.0}, ...]
    }, ...]
}
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
"price=10&quantity=10&price_type=BTC&quantity_type=MC"

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.

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": [{
        "price_type": "BTC",
        "quantity_type": "MC",
        "ticks": [{
            "trader_id": "12c406358ba05e5883a75da3f009477e4ca699a9",
            "timeout": 3600,
            "quantity_type": "MC",
            "price_type": "BTC",
            "timestamp": 1493905920.68573,
            "price": 10.0,
            "order_number": 1,
            "message_id": "12c406358ba05e5883a75da3f009477e4ca699a9.1",
            "quantity": 10.0}, ...]
    }, ...]
}
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
"price=10&quantity=10&price_type=BTC&quantity_type=MC"

Example response:

{
    "created": True
}
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,
        "price": 10.0,
        "quantity_type": "MC",
        "reserved_quantity": 0.0,
        "is_ask": False,
        "price_type": "BTC",
        "timeout": 3600.0,
        "traded_quantity": 0.0,
        "order_number": 1,
        "completed_timestamp": null,
        "quantity": 10.0
    }]
}
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",
        "transaction_number": 3,
        "price": 10,
        "price_type": "MC",
        "transferred_price": 5,
        "quantity": 10,
        "quantity_type": "BTC",
        "transferred_quantity": 4,
        "timestamp": 1493906434.627721,
        "payment_complete": False
    ]
}