MCPcopy Create free account
hub / github.com/Rushifakami/csfloat_api / create_listing

Method create_listing

csfloat_client.py:381–426  ·  view source on GitHub ↗

:param asset_id: The ID of the item to list :param price: The buy_now price or the current bid or reserve price on an auction :param type_: Either 'buy_now' or 'auction' (default: 'buy_now') :param max_offer_discount: The max discount for an offer (optional)

(
        self,
        *,
        asset_id: str,
        price: float,
        type_: str = "buy_now",
        max_offer_discount: Optional[int] = None,
        reserve_price: Optional[float] = None,
        duration_days: Optional[int] = None,
        description: str = "",
        private: bool = False,
    )

Source from the content-addressed store, hash-verified

379
380
381 async def create_listing(
382 self,
383 *,
384 asset_id: str,
385 price: float,
386 type_: str = "buy_now",
387 max_offer_discount: Optional[int] = None,
388 reserve_price: Optional[float] = None,
389 duration_days: Optional[int] = None,
390 description: str = "",
391 private: bool = False,
392 ) -> Optional[dict]:
393 """
394 :param asset_id: The ID of the item to list
395 :param price: The buy_now price or the current bid or reserve price on an auction
396 :param type_: Either 'buy_now' or 'auction' (default: 'buy_now')
397 :param max_offer_discount: The max discount for an offer (optional)
398 :param reserve_price: The starting price for an auction (required if type is 'auction')
399 :param duration_days: The auction duration in days (required if type is 'auction')
400 :param description: User-defined description (optional)
401 :param private: If true, will hide the listing from public searches (optional)
402 :return: The response from the API
403 """
404 self._validate_type(type_)
405
406 parameters = "/listings"
407 method = "POST"
408
409 json_data = {
410 "asset_id": asset_id,
411 "price": price,
412 "type": type_,
413 "description": description,
414 "private": private
415 }
416
417 # Add optional parameters if provided
418 if max_offer_discount is not None:
419 json_data["max_offer_discount"] = max_offer_discount
420 if reserve_price is not None:
421 json_data["reserve_price"] = reserve_price
422 if duration_days is not None:
423 json_data["duration_days"] = duration_days
424
425 response = await self._request(method=method, parameters=parameters, json_data=json_data)
426 return response
427
428 async def create_buy_order(
429 self,

Callers

nothing calls this directly

Calls 2

_validate_typeMethod · 0.95
_requestMethod · 0.95

Tested by

no test coverage detected