Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ This is the Python version of the LN Markets API SDK. It provides a client-based
For public endpoints, you can just do this:

```python
from lnmarkets_sdk.http.client import LNMClient
from lnmarkets_sdk.v3.http.client import LNMClient
import asyncio

async with LNMClient() as client:
Expand All @@ -21,7 +21,7 @@ Remember to sleep between requests, as the rate limit is 1 requests per second f
For endpoints that need authentication, you need to create an instance of the `LNMClient` class and provide your API credentials:

```python
from lnmarkets_sdk.http.client import APIAuthContext, APIClientConfig, LNMClient
from lnmarkets_sdk.v3.http.client import APIAuthContext, APIClientConfig, LNMClient

config = APIClientConfig(
authentication=APIAuthContext(
Expand All @@ -41,8 +41,8 @@ For endpoints that requires input parameters, you can find the corresponding mod

```python

from lnmarkets_sdk.http.client import APIAuthContext, APIClientConfig, LNMClient
from lnmarkets_sdk.models.account import GetLightningDepositsParams
from lnmarkets_sdk.v3.http.client import APIAuthContext, APIClientConfig, LNMClient
from lnmarkets_sdk.v3.models.account import GetLightningDepositsParams

config = APIClientConfig(
authentication=APIAuthContext(
Expand Down
6 changes: 3 additions & 3 deletions examples/basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

from dotenv import load_dotenv

from lnmarkets_sdk.http.client import APIAuthContext, APIClientConfig, LNMClient
from lnmarkets_sdk.models.account import GetLightningDepositsParams
from lnmarkets_sdk.models.futures_cross import (
from lnmarkets_sdk.v3.http.client import APIAuthContext, APIClientConfig, LNMClient
from lnmarkets_sdk.v3.models.account import GetLightningDepositsParams
from lnmarkets_sdk.v3.models.futures_cross import (
FuturesCrossOrderLimit,
)

Expand Down
3 changes: 1 addition & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
urls = { "Homepage" = "https://github.com/ln-markets/sdk-python", "Repository" = "https://github.com/ln-markets/sdk-python", "Bug Tracker" = "https://github.com/ln-markets/sdk-python/issues" }

name = "lnmarkets-sdk"
version = "0.0.7"
version = "0.0.11"
description = "LN Markets API Python SDK"
readme = "README.md"
license = { text = "MIT" }
Expand Down Expand Up @@ -80,7 +80,6 @@ quote-style = "double"
indent-style = "space"

[tool.pytest.ini_options]
# testpaths = ["tests"]
python_files = ["test_*.py"]
python_classes = ["Test*"]
python_functions = ["test_*"]
Expand Down
1 change: 0 additions & 1 deletion src/lnmarkets_sdk/__init__.py

This file was deleted.

Empty file removed src/lnmarkets_sdk/http/__init__.py
Empty file.
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@

from pydantic import BaseModel

from lnmarkets_sdk._internal import BaseClient
from lnmarkets_sdk._internal.models import APIAuthContext, APIClientConfig, APIMethod
from lnmarkets_sdk._internal.utils import get_hostname, parse_response
from lnmarkets_sdk.v3._internal import BaseClient
from lnmarkets_sdk.v3._internal.models import APIAuthContext, APIClientConfig, APIMethod
from lnmarkets_sdk.v3._internal.utils import get_hostname, parse_response

from .account import AccountClient
from .futures import FuturesClient
Expand All @@ -30,8 +30,8 @@ def __init__(self, config: APIClientConfig | None = None):
config: Client configuration. If None, will use environment variables.

Example:
>>> from src.lnmarkets_sdk.client import LNMClient
>>> from src.lnmarkets_sdk.types.api.base import APIClientConfig, APIAuthContext
>>> from src.lnmarkets_sdk.v3.client import LNMClient
>>> from src.lnmarkets_sdk.v3.types.api.base import APIClientConfig, APIAuthContext
>>>
>>> config = APIClientConfig(
... authentication=APIAuthContext(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from lnmarkets_sdk.http.client import LNMClient
from lnmarkets_sdk.v3.http.client import LNMClient

from lnmarkets_sdk.models.account import (
from lnmarkets_sdk.v3.models.account import (
Account,
AddBitcoinAddressParams,
AddBitcoinAddressResponse,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from lnmarkets_sdk.http.client import LNMClient
from lnmarkets_sdk.v3.http.client import LNMClient

from lnmarkets_sdk.models.funding_fees import GetFundingSettlementsResponse
from lnmarkets_sdk.models.futures_data import (
from lnmarkets_sdk.v3.models.funding_fees import GetFundingSettlementsResponse
from lnmarkets_sdk.v3.models.futures_data import (
Candle,
GetCandlesParams,
GetFundingSettlementsParams,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from lnmarkets_sdk.http.client import LNMClient
from lnmarkets_sdk.v3.http.client import LNMClient

from lnmarkets_sdk.models.funding_fees import FundingFees
from lnmarkets_sdk.models.futures_cross import (
from lnmarkets_sdk.v3.models.funding_fees import FundingFees
from lnmarkets_sdk.v3.models.futures_cross import (
CancelOrderParams,
DepositParams,
FuturesCrossCanceledOrder,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from lnmarkets_sdk.http.client import LNMClient
from lnmarkets_sdk.v3.http.client import LNMClient

from lnmarkets_sdk.models.funding_fees import FundingFees
from lnmarkets_sdk.models.futures_isolated import (
from lnmarkets_sdk.v3.models.funding_fees import FundingFees
from lnmarkets_sdk.v3.models.futures_isolated import (
AddMarginParams,
CancelTradeParams,
CashInParams,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from lnmarkets_sdk.http.client import LNMClient
from lnmarkets_sdk.v3.http.client import LNMClient

from lnmarkets_sdk.models.oracle import (
from lnmarkets_sdk.v3.models.oracle import (
GetIndexParams,
GetLastPriceParams,
OracleIndex,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import TYPE_CHECKING

if TYPE_CHECKING:
from lnmarkets_sdk.http.client import LNMClient
from lnmarkets_sdk.v3.http.client import LNMClient

from lnmarkets_sdk.models.synthetic_usd import (
from lnmarkets_sdk.v3.models.synthetic_usd import (
BestPriceResponse,
CreateSwapOutput,
GetSwapsParams,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pydantic import BaseModel, Field

from lnmarkets_sdk._internal.models import UUID, BaseConfig, FromToLimitParams
from lnmarkets_sdk.v3._internal.models import UUID, BaseConfig, FromToLimitParams


class Account(BaseModel, BaseConfig):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pydantic import BaseModel, Field

from lnmarkets_sdk._internal.models import UUID, BaseConfig
from lnmarkets_sdk.v3._internal.models import UUID, BaseConfig


class FundingFees(BaseModel, BaseConfig):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pydantic import BaseModel, Field

from lnmarkets_sdk._internal.models import UUID, BaseConfig, FromToLimitParams
from lnmarkets_sdk.v3._internal.models import UUID, BaseConfig, FromToLimitParams


class FuturesCrossOrderSideQuantity(BaseModel, BaseConfig):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pydantic import BaseModel, Field

from lnmarkets_sdk._internal.models import BaseConfig, FromToLimitParams
from lnmarkets_sdk.v3._internal.models import BaseConfig, FromToLimitParams

CandleResolution = Literal[
"1m",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pydantic import BaseModel, Field, model_validator

from lnmarkets_sdk._internal.models import UUID, BaseConfig, FromToLimitParams
from lnmarkets_sdk.v3._internal.models import UUID, BaseConfig, FromToLimitParams


class FuturesOrder(BaseModel, BaseConfig):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from pydantic import BaseModel, Field

from lnmarkets_sdk._internal.models import BaseConfig, FromToLimitParams
from lnmarkets_sdk.v3._internal.models import BaseConfig, FromToLimitParams


class OracleIndex(BaseModel, BaseConfig):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from pydantic import BaseModel, Field

from lnmarkets_sdk._internal.models import UUID, BaseConfig, FromToLimitParams
from lnmarkets_sdk.v3._internal.models import UUID, BaseConfig, FromToLimitParams

SwapAssets = Literal["BTC", "USD"]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import pytest
from dotenv import load_dotenv

from lnmarkets_sdk.http.client import APIAuthContext, APIClientConfig, LNMClient
from lnmarkets_sdk.models.account import (
from lnmarkets_sdk.v3.http.client import APIAuthContext, APIClientConfig, LNMClient
from lnmarkets_sdk.v3.models.account import (
AddBitcoinAddressParams,
DepositLightningParams,
GetInternalDepositsParams,
Expand All @@ -19,7 +19,7 @@
WithdrawLightningParams,
WithdrawOnChainParams,
)
from lnmarkets_sdk.models.futures_isolated import FuturesOrder
from lnmarkets_sdk.v3.models.futures_isolated import FuturesOrder

load_dotenv()

Expand Down Expand Up @@ -270,7 +270,7 @@ async def test_get_leaderboard(self):
assert isinstance(leaderboard.daily, list)

async def test_get_candles(self):
from lnmarkets_sdk.models.futures_data import GetCandlesParams
from lnmarkets_sdk.v3.models.futures_data import GetCandlesParams

async with LNMClient(create_public_config()) as client:
params = GetCandlesParams(
Expand Down Expand Up @@ -316,7 +316,7 @@ async def test_futures_isolated(self):
assert trade.id in trade_ids

# Cancel the trade
from lnmarkets_sdk.models.futures_isolated import CancelTradeParams
from lnmarkets_sdk.v3.models.futures_isolated import CancelTradeParams

cancel_params = CancelTradeParams(id=trade.id)
canceled = await client.futures.isolated.cancel(cancel_params)
Expand Down Expand Up @@ -349,7 +349,7 @@ async def test_cross_orders(self):
assert isinstance(open_orders, list)

# Get filled orders
from lnmarkets_sdk.models.futures_cross import GetFilledOrdersParams
from lnmarkets_sdk.v3.models.futures_cross import GetFilledOrdersParams

params = GetFilledOrdersParams(limit=5)
filled_orders = await client.futures.cross.get_filled_orders(params)
Expand All @@ -367,7 +367,7 @@ async def test_get_last_price(self):
assert result[0].time is not None

async def test_get_index(self):
from lnmarkets_sdk.models.oracle import GetIndexParams
from lnmarkets_sdk.v3.models.oracle import GetIndexParams

async with LNMClient(create_public_config()) as client:
params = GetIndexParams(limit=5)
Expand All @@ -391,7 +391,7 @@ async def test_get_best_price(self):
reason="V3_API_KEY not set in environment",
)
async def test_get_swaps(self):
from lnmarkets_sdk.models.synthetic_usd import GetSwapsParams
from lnmarkets_sdk.v3.models.synthetic_usd import GetSwapsParams

async with LNMClient(create_auth_config()) as client:
params = GetSwapsParams(limit=5)
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading