Port Agora API copy to LocalBitcoins
This commit is contained in:
parent
ff96322ffd
commit
32d4a9d0bd
|
@ -226,83 +226,83 @@ class LocalBitcoins:
|
|||
# ===========================
|
||||
|
||||
def account_info(self, username: str) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getUserByUsername
|
||||
https://localbitcoins.com/api-docs/#account_info
|
||||
"""
|
||||
return self._api_call(api_method=f"account_info/{username}")
|
||||
|
||||
def dashboard(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getUserDashboard
|
||||
https://localbitcoins.com/api-docs/#dashboard
|
||||
"""
|
||||
return self._api_call(api_method="dashboard")
|
||||
|
||||
def dashboard_buyer(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
# def dashboard_buyer(self) -> Dict[str, Any]:
|
||||
# """See LocalBitcoins API.
|
||||
#
|
||||
# https://agoradesk.com/api-docs/v1#operation/getUserDashboardBuyer
|
||||
# """
|
||||
# return self._api_call(api_method="dashboard/buyer")
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getUserDashboardBuyer
|
||||
"""
|
||||
return self._api_call(api_method="dashboard/buyer")
|
||||
|
||||
def dashboard_seller(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getUserDashboardSeller
|
||||
"""
|
||||
return self._api_call(api_method="dashboard/seller")
|
||||
# def dashboard_seller(self) -> Dict[str, Any]:
|
||||
# """See LocalBitcoins API.
|
||||
#
|
||||
# https://agoradesk.com/api-docs/v1#operation/getUserDashboardSeller
|
||||
# """
|
||||
# return self._api_call(api_method="dashboard/seller")
|
||||
|
||||
def dashboard_canceled(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getUserDashboardCanceled
|
||||
https://localbitcoins.com/api-docs/#dashboard-canceled
|
||||
"""
|
||||
return self._api_call(api_method="dashboard/canceled")
|
||||
|
||||
def dashboard_closed(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getUserDashboardClosed
|
||||
https://localbitcoins.com/api-docs/#dashboard-closed
|
||||
"""
|
||||
return self._api_call(api_method="dashboard/closed")
|
||||
|
||||
def dashboard_released(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getUserDashboardReleased
|
||||
https://localbitcoins.com/api-docs/#dashboard-released
|
||||
"""
|
||||
|
||||
return self._api_call(api_method="dashboard/released")
|
||||
|
||||
def logout(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/logout
|
||||
https://localbitcoins.com/api-docs/#logout
|
||||
"""
|
||||
|
||||
return self._api_call(api_method="logout", http_method="POST")
|
||||
|
||||
def myself(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getTokenOwnerUserData
|
||||
https://localbitcoins.com/api-docs/#myself
|
||||
"""
|
||||
|
||||
return self._api_call(api_method="myself")
|
||||
|
||||
def notifications(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getUserNotifications
|
||||
https://localbitcoins.com/api-docs/#notifications
|
||||
"""
|
||||
|
||||
return self._api_call(api_method="notifications")
|
||||
|
||||
def notifications_mark_as_read(self, notification_id: str) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/markNotificationRead
|
||||
https://localbitcoins.com/api-docs/#notifications-read
|
||||
"""
|
||||
|
||||
return self._api_call(
|
||||
|
@ -311,9 +311,9 @@ class LocalBitcoins:
|
|||
)
|
||||
|
||||
def recent_messages(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getRecemtMessages
|
||||
https://localbitcoins.com/api-docs/#recent-messages
|
||||
"""
|
||||
|
||||
return self._api_call(api_method="recent_messages")
|
||||
|
@ -323,9 +323,9 @@ class LocalBitcoins:
|
|||
|
||||
# post/feedback/{username} • Give feedback to a user
|
||||
def feedback(self, username: str, feedback: str, msg: Optional[str]) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/setUserFeedback
|
||||
https://localbitcoins.com/api-docs/#feedback
|
||||
"""
|
||||
|
||||
params = {"feedback": feedback}
|
||||
|
@ -344,9 +344,9 @@ class LocalBitcoins:
|
|||
|
||||
# post/contact_mark_as_paid/{trade_id} • Mark a trade as paid
|
||||
def contact_mark_as_paid(self, trade_id: str) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/markPaid
|
||||
https://localbitcoins.com/api-docs/#contact-paid
|
||||
"""
|
||||
return self._api_call(api_method=f"contact_mark_as_paid/{trade_id}", http_method="POST")
|
||||
|
||||
|
@ -355,9 +355,9 @@ class LocalBitcoins:
|
|||
self,
|
||||
trade_id: str,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/cancelTrade
|
||||
https://localbitcoins.com/api-docs/#contact-cancel
|
||||
"""
|
||||
return self._api_call(
|
||||
api_method=f"contact_cancel/{trade_id}",
|
||||
|
@ -369,9 +369,9 @@ class LocalBitcoins:
|
|||
|
||||
# get/contact_messages/{trade_id} • Get trade messages
|
||||
def contact_messages(self, trade_id: str, after: Optional[arrow.Arrow] = None) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getTradeMessages
|
||||
https://localbitcoins.com/api-docs/#contact-message
|
||||
"""
|
||||
if after:
|
||||
reply = self._api_call(
|
||||
|
@ -390,9 +390,9 @@ class LocalBitcoins:
|
|||
amount: float,
|
||||
msg: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/startTrade
|
||||
https://localbitcoins.com/api-docs/#contact-create
|
||||
"""
|
||||
payload: Dict[str, Any] = {"amount": amount}
|
||||
if msg:
|
||||
|
@ -405,10 +405,10 @@ class LocalBitcoins:
|
|||
|
||||
# get/contact_info/{trade_id} • Get a trade by trade ID
|
||||
def contact_info(self, trade_ids: Union[str, List[str]]) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getTradeById and
|
||||
https://agoradesk.com/api-docs/v1#operation/getTradesInBulk
|
||||
https://localbitcoins.com/api-docs/#contact-info-id and
|
||||
https://localbitcoins.com/api-docs/#contact-info
|
||||
"""
|
||||
api_method = "contact_info"
|
||||
if isinstance(trade_ids, list):
|
||||
|
@ -424,9 +424,9 @@ class LocalBitcoins:
|
|||
# Todo: Add image upload functionality
|
||||
# post/contact_message_post/{trade_id} • Send a chat message/attachment
|
||||
def contact_message_post(self, trade_id: str, msg: Optional[str] = None) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/sendChatMessage
|
||||
https://localbitcoins.com/api-docs/#contact-post
|
||||
"""
|
||||
payload = {"msg": msg}
|
||||
return self._api_call(
|
||||
|
@ -441,7 +441,7 @@ class LocalBitcoins:
|
|||
# Advertisement related API Methods
|
||||
# ================================
|
||||
|
||||
def ad_create(
|
||||
def ad_create( # TODO: fill fields
|
||||
self,
|
||||
country_code: str,
|
||||
currency: str,
|
||||
|
@ -465,9 +465,9 @@ class LocalBitcoins:
|
|||
lat: Optional[float] = None,
|
||||
lon: Optional[float] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/createAd
|
||||
https://localbitcoins.com/api-docs/#ad-create
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
@ -546,9 +546,9 @@ class LocalBitcoins:
|
|||
lon: Optional[float] = None,
|
||||
visible: Optional[bool] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/editAd
|
||||
https://localbitcoins.com/api-docs/#ad-id
|
||||
"""
|
||||
|
||||
# pylint: disable=invalid-name
|
||||
|
@ -612,9 +612,9 @@ class LocalBitcoins:
|
|||
)
|
||||
|
||||
def ad_equation(self, ad_id: str, price_equation: str) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/updateFormula
|
||||
https://localbitcoins.com/api-docs/#ad-equation-id
|
||||
"""
|
||||
return self._api_call(
|
||||
api_method=f"ad-equation/{ad_id}",
|
||||
|
@ -623,9 +623,9 @@ class LocalBitcoins:
|
|||
)
|
||||
|
||||
def ad_delete(self, ad_id: str) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/deleteAd
|
||||
https://localbitcoins.com/api-docs/#ad-delete
|
||||
"""
|
||||
return self._api_call(api_method=f"ad-delete/{ad_id}", http_method="POST")
|
||||
|
||||
|
@ -638,9 +638,9 @@ class LocalBitcoins:
|
|||
asset: Optional[str] = None,
|
||||
payment_method_code: Optional[str] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getYourAds
|
||||
https://localbitcoins.com/api-docs/#ads
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
@ -668,10 +668,10 @@ class LocalBitcoins:
|
|||
return self._api_call(api_method="ads", query_values=params)
|
||||
|
||||
def ad_get(self, ad_ids: List[str]) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getAdById and
|
||||
https://agoradesk.com/api-docs/v1#operation/getAdsInBulk
|
||||
https://localbitcoins.com/api-docs/#ad-get and
|
||||
hhttps://localbitcoins.com/api-docs/#ad-get-id
|
||||
"""
|
||||
api_method = "ad-get"
|
||||
params = None
|
||||
|
@ -684,10 +684,10 @@ class LocalBitcoins:
|
|||
return self._api_call(api_method=api_method, query_values=params)
|
||||
|
||||
def payment_methods(self, country_code: Optional[str] = None) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/paymentMethods and
|
||||
https://agoradesk.com/api-docs/v1#operation/countryHasPaymentMethod
|
||||
https://localbitcoins.com/api-docs/#payment-methods and
|
||||
https://localbitcoins.com/api-docs/#payment_methods-cc
|
||||
"""
|
||||
api_method = "payment_methods"
|
||||
if country_code:
|
||||
|
@ -695,23 +695,23 @@ class LocalBitcoins:
|
|||
return self._api_call(api_method=api_method)
|
||||
|
||||
def country_codes(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/countryCodes
|
||||
https://localbitcoins.com/api-docs/#countrycodes
|
||||
"""
|
||||
return self._api_call(api_method="countrycodes")
|
||||
|
||||
def currencies(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/currencyCodes
|
||||
https://localbitcoins.com/api-docs/#currencies
|
||||
"""
|
||||
return self._api_call(api_method="currencies")
|
||||
|
||||
def equation(self, price_equation: str, currency: str) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/priceFormula
|
||||
https://localbitcoins.com/api-docs/#equation
|
||||
"""
|
||||
return self._api_call(
|
||||
api_method="equation",
|
||||
|
@ -759,7 +759,7 @@ class LocalBitcoins:
|
|||
params = {"page": f"{page}"}
|
||||
return params
|
||||
|
||||
def buy_monero_online(
|
||||
def buy_bitcoins_online( # TODO: check fields
|
||||
self,
|
||||
currency_code: str,
|
||||
country_code: Optional[str] = None,
|
||||
|
@ -767,40 +767,14 @@ class LocalBitcoins:
|
|||
amount: Optional[float] = None,
|
||||
page: Optional[int] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineSellXmrByCurrencyCode and
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineSellXmrByCurrencyCodeAndCountryCode and # noqa: E501 pylint: disable=line-too-long
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineSellXmrByCurrencyCodeAndPaymentMethodCode and # noqa: E501 pylint: disable=line-too-long
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineSellXmrByCurrencyCodeAndCountryCodeAndPaymentMethodCode # noqa: E501 pylint: disable=line-too-long
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
return self._generic_online(
|
||||
direction="buy",
|
||||
main_currency="monero",
|
||||
exchange_currency=currency_code,
|
||||
country_code=country_code,
|
||||
payment_method=payment_method,
|
||||
amount=amount,
|
||||
page=page,
|
||||
)
|
||||
|
||||
def buy_bitcoins_online(
|
||||
self,
|
||||
currency_code: str,
|
||||
country_code: Optional[str] = None,
|
||||
payment_method: Optional[str] = None,
|
||||
amount: Optional[float] = None,
|
||||
page: Optional[int] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineSellBtcByCurrencyCode
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineSellBtcByCurrencyCodeAndCountryCode and # noqa: E501 pylint: disable=line-too-long
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineSellBtcByCurrencyCodeAndPaymentMethodCode and # noqa: E501 pylint: disable=line-too-long
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineSellBtcByCurrencyCodeAndCountryCodeAndPaymentMethodCode # noqa: E501 pylint: disable=line-too-long
|
||||
https://localbitcoins.com/api-docs/#online-buy1 and
|
||||
https://localbitcoins.com/api-docs/#online-buy2 and
|
||||
https://localbitcoins.com/api-docs/#online-buy3 and
|
||||
https://localbitcoins.com/api-docs/#online-buy4 and
|
||||
https://localbitcoins.com/api-docs/#online-buy5 and
|
||||
https://localbitcoins.com/api-docs/#online-buy6
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
@ -815,34 +789,6 @@ class LocalBitcoins:
|
|||
page=page,
|
||||
)
|
||||
|
||||
def sell_monero_online(
|
||||
self,
|
||||
currency_code: str,
|
||||
country_code: Optional[str] = None,
|
||||
payment_method: Optional[str] = None,
|
||||
amount: Optional[float] = None,
|
||||
page: Optional[int] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineBuyXmrByCurrencyCode
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineBuyXmrByCurrencyCodeAndCountryCode and # noqa: E501 pylint: disable=line-too-long
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineBuyXmrByCurrencyCodeAndPaymentMethodCode and # noqa: E501 pylint: disable=line-too-long
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineBuyXmrByCurrencyCodeAndCountryCodeAndPaymentMethodCode # noqa: E501 pylint: disable=line-too-long
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
return self._generic_online(
|
||||
direction="sell",
|
||||
main_currency="monero",
|
||||
exchange_currency=currency_code,
|
||||
country_code=country_code,
|
||||
payment_method=payment_method,
|
||||
amount=amount,
|
||||
page=page,
|
||||
)
|
||||
|
||||
def sell_bitcoins_online(
|
||||
self,
|
||||
currency_code: str,
|
||||
|
@ -851,12 +797,14 @@ class LocalBitcoins:
|
|||
amount: Optional[float] = None,
|
||||
page: Optional[int] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineBuyBtcByCurrencyCode
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineBuyBtcByCurrencyCodeAndCountryCode and # noqa: E501 pylint: disable=line-too-long
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineBuyBtcByCurrencyCodeAndPaymentMethodCode and # noqa: E501 pylint: disable=line-too-long
|
||||
https://agoradesk.com/api-docs/v1#operation/getOnlineBuyBtcByCurrencyCodeAndCountryCodeAndPaymentMethodCode # noqa: E501 pylint: disable=line-too-long
|
||||
https://localbitcoins.com/api-docs/#online-sell1 and
|
||||
https://localbitcoins.com/api-docs/#online-sell2 and
|
||||
https://localbitcoins.com/api-docs/#online-sell3 and
|
||||
https://localbitcoins.com/api-docs/#online-sell4 and
|
||||
https://localbitcoins.com/api-docs/#online-sell5 and
|
||||
https://localbitcoins.com/api-docs/#online-sell6
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
@ -871,215 +819,58 @@ class LocalBitcoins:
|
|||
page=page,
|
||||
)
|
||||
|
||||
def _generic_cash(
|
||||
self,
|
||||
direction: str,
|
||||
main_currency: str,
|
||||
exchange_currency: str,
|
||||
country_code: str,
|
||||
lat: str,
|
||||
lon: str,
|
||||
amount: Optional[float] = None,
|
||||
page: Optional[int] = None,
|
||||
) -> Dict[str, Any]:
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
params = self._generic_search_parameters(amount, page)
|
||||
|
||||
return self._api_call(
|
||||
api_method=f"{direction}-{main_currency}-with-cash/" f"{exchange_currency}/{country_code}/{lat}/{lon}",
|
||||
query_values=params,
|
||||
)
|
||||
|
||||
def buy_monero_with_cash(
|
||||
self,
|
||||
currency_code: str,
|
||||
country_code: str,
|
||||
lat: str,
|
||||
lon: str,
|
||||
amount: Optional[float] = None,
|
||||
page: Optional[int] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getLocalSellXmrByCurrencyCodeAndCountryCode # noqa: E501 pylint: disable=line-too-long
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
return self._generic_cash(
|
||||
direction="buy",
|
||||
main_currency="monero",
|
||||
exchange_currency=currency_code,
|
||||
country_code=country_code,
|
||||
lat=lat,
|
||||
lon=lon,
|
||||
amount=amount,
|
||||
page=page,
|
||||
)
|
||||
|
||||
def buy_bitcoins_with_cash(
|
||||
self,
|
||||
currency_code: str,
|
||||
country_code: str,
|
||||
lat: str,
|
||||
lon: str,
|
||||
amount: Optional[float] = None,
|
||||
page: Optional[int] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getLocalSellBtcByCurrencyCodeAndCountryCode # noqa: E501 pylint: disable=line-too-long
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
return self._generic_cash(
|
||||
direction="buy",
|
||||
main_currency="bitcoins",
|
||||
exchange_currency=currency_code,
|
||||
country_code=country_code,
|
||||
lat=lat,
|
||||
lon=lon,
|
||||
amount=amount,
|
||||
page=page,
|
||||
)
|
||||
|
||||
def sell_monero_with_cash(
|
||||
self,
|
||||
currency_code: str,
|
||||
country_code: str,
|
||||
lat: str,
|
||||
lon: str,
|
||||
amount: Optional[float] = None,
|
||||
page: Optional[int] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getLocalBuyXmrByCurrencyCodeAndCountryCode # noqa: E501 pylint: disable=line-too-long
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
return self._generic_cash(
|
||||
direction="sell",
|
||||
main_currency="monero",
|
||||
exchange_currency=currency_code,
|
||||
country_code=country_code,
|
||||
lat=lat,
|
||||
lon=lon,
|
||||
amount=amount,
|
||||
page=page,
|
||||
)
|
||||
|
||||
def sell_bitcoins_with_cash(
|
||||
self,
|
||||
currency_code: str,
|
||||
country_code: str,
|
||||
lat: str,
|
||||
lon: str,
|
||||
amount: Optional[float] = None,
|
||||
page: Optional[int] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getLocalBuyBtcByCurrencyCodeAndCountryCode # noqa: E501 pylint: disable=line-too-long
|
||||
"""
|
||||
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
return self._generic_cash(
|
||||
direction="sell",
|
||||
main_currency="bitcoins",
|
||||
exchange_currency=currency_code,
|
||||
country_code=country_code,
|
||||
lat=lat,
|
||||
lon=lon,
|
||||
amount=amount,
|
||||
page=page,
|
||||
)
|
||||
|
||||
# Statistics related API Methods
|
||||
# ==============================
|
||||
|
||||
def moneroaverage(self, currency: Optional[str] = "ticker-all-currencies") -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
def bitcoinaverage(self) -> Dict[str, Any]:
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getXmrTicker and
|
||||
https://agoradesk.com/api-docs/v1#operation/getXmrTickerByCurrencyCode
|
||||
https://localbitcoins.com/api-docs/#ticker-all
|
||||
"""
|
||||
return self._api_call(api_method=f"moneroaverage/{currency}")
|
||||
return self._api_call(api_method="bitcoinaverage/ticket-all-currencies")
|
||||
|
||||
# Wallet related API Methods
|
||||
# ===========================
|
||||
|
||||
def wallet(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getBtcWallet
|
||||
https://localbitcoins.com/api-docs/#wallet
|
||||
"""
|
||||
return self._api_call(api_method="wallet")
|
||||
|
||||
def wallet_balance(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getBtcWalletBalance
|
||||
https://localbitcoins.com/api-docs/#wallet-balance
|
||||
"""
|
||||
return self._api_call(api_method="wallet-balance")
|
||||
|
||||
def wallet_xmr(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getXmrWallet
|
||||
"""
|
||||
return self._api_call(api_method="wallet/XMR")
|
||||
|
||||
def wallet_balance_xmr(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getXmrWalletBalance
|
||||
"""
|
||||
return self._api_call(api_method="wallet-balance/XMR")
|
||||
|
||||
def wallet_addr(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getBtcAddress
|
||||
https://localbitcoins.com/api-docs/#wallet-addr
|
||||
"""
|
||||
return self._api_call(api_method="wallet-addr")
|
||||
|
||||
def wallet_addr_xmr(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getXMRAddress
|
||||
"""
|
||||
return self._api_call(api_method="wallet-addr/XMR")
|
||||
|
||||
def fees(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getBtcFee
|
||||
https://localbitcoins.com/api-docs/#fees
|
||||
"""
|
||||
return self._api_call(api_method="fees")
|
||||
|
||||
def fees_xmr(self) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/getXmrFee
|
||||
"""
|
||||
return self._api_call(api_method="fees/XMR")
|
||||
|
||||
def wallet_send(
|
||||
def wallet_send_pin(
|
||||
self,
|
||||
address: str,
|
||||
amount: float,
|
||||
password: str,
|
||||
fee_level: str,
|
||||
otp: Optional[int] = None,
|
||||
pincode: Optional[int] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
"""See LocalBitcoins API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/withdrawBtc
|
||||
https://localbitcoins.com/api-docs/#wallet-send
|
||||
"""
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
|
@ -1089,32 +880,7 @@ class LocalBitcoins:
|
|||
"password": password,
|
||||
"fee_level": fee_level,
|
||||
}
|
||||
if otp:
|
||||
params["otp"] = otp
|
||||
if pincode:
|
||||
params["pincode"] = pincode
|
||||
|
||||
return self._api_call(api_method="wallet-send", http_method="POST", query_values=params)
|
||||
|
||||
def wallet_send_xmr(
|
||||
self,
|
||||
address: str,
|
||||
amount: float,
|
||||
password: str,
|
||||
# fee_level: str,
|
||||
otp: Optional[int] = None,
|
||||
) -> Dict[str, Any]:
|
||||
"""See Agoradesk API.
|
||||
|
||||
https://agoradesk.com/api-docs/v1#operation/withdrawXmr
|
||||
"""
|
||||
# pylint: disable=too-many-arguments
|
||||
|
||||
params = {
|
||||
"address": address,
|
||||
"amount": amount,
|
||||
"password": password,
|
||||
# "fee_level": fee_level,
|
||||
}
|
||||
if otp:
|
||||
params["otp"] = otp
|
||||
|
||||
return self._api_call(api_method="wallet-send/XMR", http_method="POST", query_values=params)
|
||||
return self._api_call(api_method="wallet-send-pin", http_method="POST", query_values=params)
|
||||
|
|
Loading…
Reference in New Issue