Skip to content

Commit

Permalink
Merge pull request #12 from 8ball030/feat/cli-filters
Browse files Browse the repository at this point in the history
feat(cli): Add support for fetching instruments by currency
  • Loading branch information
8ball030 authored Dec 25, 2023
2 parents 622538c + f8019e9 commit 65eda19
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions lyra/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from dotenv import load_dotenv
from rich import print

from lyra.enums import Environment, InstrumentType, OrderStatus
from lyra.enums import Environment, InstrumentType, OrderStatus, UnderlyingCurrency
from lyra.lyra import LyraClient
from lyra.utils import get_logger

Expand Down Expand Up @@ -88,10 +88,18 @@ def orders():
type=click.Choice([f.value for f in InstrumentType]),
default=InstrumentType.PERP.value,
)
def fetch_instruments(ctx, instrument_type):
@click.option(
"--currency",
"-c",
type=click.Choice([f.value for f in UnderlyingCurrency]),
default=UnderlyingCurrency.ETH.value,
)
def fetch_instruments(ctx, instrument_type, currency):
"""Fetch markets."""
client = ctx.obj["client"]
markets = client.fetch_instruments(instrument_type=InstrumentType(instrument_type))
markets = client.fetch_instruments(
instrument_type=InstrumentType(instrument_type), currency=UnderlyingCurrency(currency)
)
print(markets)


Expand Down

0 comments on commit 65eda19

Please sign in to comment.