prod deployment
This commit is contained in:
@@ -30,7 +30,7 @@ type hints, docstrings, and examples.
|
||||
### api.py
|
||||
```python
|
||||
"""
|
||||
Main DexOrder API - provides access to market data and charting.
|
||||
Main Dexorder API - provides access to market data and charting.
|
||||
"""
|
||||
|
||||
import logging
|
||||
@@ -311,8 +311,10 @@ class ChartingAPI(ABC):
|
||||
)
|
||||
|
||||
# Overlay moving average
|
||||
# NOTE: mplfinance uses integer x-positions (0..N-1) internally,
|
||||
# so overlays must use range(len(df)), not df.index.
|
||||
fig, ax = api.plot_ohlc(df)
|
||||
ax.plot(df.index, df['sma_20'], label="SMA 20", color="blue")
|
||||
ax.plot(range(len(df)), df['sma_20'], label="SMA 20", color="blue")
|
||||
ax.legend()
|
||||
"""
|
||||
pass
|
||||
@@ -406,7 +408,7 @@ class ChartingAPI(ABC):
|
||||
### __init__.py
|
||||
```python
|
||||
"""
|
||||
DexOrder API - market data and charting for research and trading.
|
||||
Dexorder API - market data and charting for research and trading.
|
||||
|
||||
For research scripts, import and use get_api() to access the API:
|
||||
|
||||
|
||||
@@ -214,7 +214,7 @@ df['macd_signal'] = macd_df.iloc[:, 2]
|
||||
|
||||
# Main price chart with EMA overlay
|
||||
fig, ax = api.charting.plot_ohlc(df, title="BTC/USDT 1H", volume=True)
|
||||
ax.plot(df.index, df['ema_20'], label="EMA 20", color="orange", linewidth=1.5)
|
||||
ax.plot(range(len(df)), df['ema_20'], label="EMA 20", color="orange", linewidth=1.5) # range(len(df)), not df.index
|
||||
ax.legend()
|
||||
|
||||
# RSI panel
|
||||
|
||||
@@ -137,7 +137,8 @@ df['rsi'] = ta.rsi(df['close'], length=14)
|
||||
fig, ax = api.charting.plot_ohlc(df, title="BTC/USDT with SMA")
|
||||
|
||||
# Overlay the SMA on the price chart
|
||||
ax.plot(df.index, df['sma_20'], label="SMA 20", color="blue", linewidth=2)
|
||||
# NOTE: mplfinance uses integer x-positions (0..N-1); use range(len(df)), not df.index.
|
||||
ax.plot(range(len(df)), df['sma_20'], label="SMA 20", color="blue", linewidth=2)
|
||||
ax.legend()
|
||||
|
||||
# Add RSI indicator panel below
|
||||
@@ -211,8 +212,9 @@ fig, ax = api.charting.plot_ohlc(
|
||||
)
|
||||
|
||||
# Overlay moving averages
|
||||
ax.plot(df.index, df['sma_20'], label="SMA 20", color="blue", linewidth=1.5)
|
||||
ax.plot(df.index, df['ema_50'], label="EMA 50", color="red", linewidth=1.5)
|
||||
# NOTE: mplfinance uses integer x-positions (0..N-1); use range(len(df)), not df.index.
|
||||
ax.plot(range(len(df)), df['sma_20'], label="SMA 20", color="blue", linewidth=1.5)
|
||||
ax.plot(range(len(df)), df['ema_50'], label="EMA 50", color="red", linewidth=1.5)
|
||||
ax.legend()
|
||||
|
||||
# Print summary statistics
|
||||
|
||||
Reference in New Issue
Block a user