Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

examples now use os.getenv instead of python-dotenv #34

Merged
merged 1 commit into from
Mar 13, 2023
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
7 changes: 3 additions & 4 deletions examples/futures_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,9 @@

"""Module that implements some example usage for the Kraken Futures REST clients"""
import logging
import os
import time

from dotenv import dotenv_values

from kraken.futures.client import Funding, Market, Trade, User

logging.basicConfig(
Expand All @@ -21,8 +20,8 @@
logging.getLogger("requests").setLevel(logging.WARNING)
logging.getLogger("urllib3").setLevel(logging.WARNING)

key = dotenv_values(".env")["Futures_SANDBOX_KEY"]
secret = dotenv_values(".env")["Futures_SANDBOX_SECRET"]
key = os.getenv("Futures_SANDBOX_KEY")
secret = os.getenv("Futures_SANDBOX_SECRET")

# _ _ ___ _____ _____
# | \ | |/ _ \_ _| ____|_
Expand Down
6 changes: 3 additions & 3 deletions examples/futures_trading_bot_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import asyncio
import logging
import logging.config
import os
import sys
import traceback

import requests
import urllib3
from dotenv import dotenv_values

from kraken.exceptions.exceptions import KrakenExceptions
from kraken.futures.client import Funding, KrakenFuturesWSClient, Market, Trade, User
Expand Down Expand Up @@ -185,8 +185,8 @@ def save_exit(self, reason: str = "") -> None:
def main() -> None:
"""Main"""
bot_config = {
"key": dotenv_values(".env")["Futures_API_KEY"],
"secret": dotenv_values(".env")["Futures_SECRET_KEY"],
"key": os.getenv("Futures_API_KEY"),
"secret": os.getenv("Futures_SECRET_KEY"),
"products": ["PI_XBTUSD", "PF_SOLUSD"],
}
managed_bot = ManagedBot(config=bot_config)
Expand Down
7 changes: 3 additions & 4 deletions examples/futures_ws_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
import asyncio
import logging
import logging.config
import os
import time

from dotenv import dotenv_values

from kraken.futures.client import KrakenFuturesWSClient

logging.basicConfig(
Expand All @@ -27,8 +26,8 @@
async def main() -> None:
"""Create bot and subscribe to topics/feeds"""

key = dotenv_values(".env")["Futures_API_KEY"]
secret = dotenv_values(".env")["Futures_SECRET_KEY"]
key = os.getenv("Futures_API_KEY")
secret = os.getenv("Futures_SECRET_KEY")

# ___Custom_Trading_Bot__________
class Bot(KrakenFuturesWSClient):
Expand Down
9 changes: 4 additions & 5 deletions examples/spot_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@
"""Module that implements some example usage for the Kraken Futures REST clients"""
import logging
import logging.config
import os
import time

from dotenv import dotenv_values

from kraken.spot.client import Funding, Market, Staking, Trade, User

logging.basicConfig(
Expand All @@ -23,8 +22,8 @@
logging.getLogger("urllib3").setLevel(logging.WARNING)


key = dotenv_values(".env")["API_KEY"]
secret = dotenv_values(".env")["SECRET_KEY"]
key = os.getenv("API_KEY")
secret = os.getenv("SECRET_KEY")

# _ _ ___ _____ _____
# | \ | |/ _ \_ _| ____|_
Expand Down Expand Up @@ -173,7 +172,7 @@ def funding_examples() -> None:
print(funding.cancel_widthdraw(asset="DOT", refid="12345"))
print(
funding.wallet_transfer(
asset="ETH", amount=0.100, from_="Spot Wallet", to="Futures Wallet"
asset="ETH", amount=0.100, from_="Spot Wallet", to_="Futures Wallet"
)
)

Expand Down
6 changes: 3 additions & 3 deletions examples/spot_trading_bot_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
import asyncio
import logging
import logging.config
import os
import sys
import traceback

import requests
import urllib3
from dotenv import dotenv_values

from kraken.exceptions.exceptions import KrakenExceptions
from kraken.spot.client import Funding, KrakenSpotWSClient, Market, Staking, Trade, User
Expand Down Expand Up @@ -207,8 +207,8 @@ def save_exit(self, reason: str = "") -> None:
def main() -> None:
"""Main"""
bot_config = {
"key": dotenv_values(".env")["API_KEY"],
"secret": dotenv_values(".env")["SECRET_KEY"],
"key": os.getenv("API_KEY"),
"secret": os.getenv("SECRET_KEY"),
"pairs": ["DOT/EUR", "XBT/USD"],
}
managed_bot = ManagedBot(config=bot_config)
Expand Down
7 changes: 3 additions & 4 deletions examples/spot_ws_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
import asyncio
import logging
import logging.config
import os
import time

from dotenv import dotenv_values

from kraken.spot.client import KrakenSpotWSClient

logging.basicConfig(
Expand All @@ -27,8 +26,8 @@
async def main() -> None:
"""Create bot and subscribe to topics/feeds"""

key = dotenv_values(".env")["API_KEY"]
secret = dotenv_values(".env")["SECRET_KEY"]
key = os.getenv("API_KEY")
secret = os.getenv("SECRET_KEY")

# ___Custom_Trading_Bot______________
class Bot(KrakenSpotWSClient):
Expand Down