Skip to content
Open
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
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
TABDEAL_API_KEY=YOUR_API_KEY_HERE
TABDEAL_API_SECRET=YOUR_API_SECRET_HERE
TABDEAL_BASE_URL=https://api1.tabdeal.org
TABDEAL_MARKET=spot
TABDEAL_SYMBOL=BTC_IRT
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,32 @@

Official python package to use [Tabdeal Exchange](https://www.tabdeal.org/) API

## Quickstart Panel

This fork adds a beginner-friendly desktop quickstart helper for local setup only.

- credentials are stored locally on the current machine only
- no real trading is performed by the panel or generated example
- the panel only supports SDK install/update, public ping, account test, config save, and example generation

### Windows

```powershell
.\install.ps1
```

### Linux

```bash
chmod +x install.sh
./install.sh
```

### Safe local configuration

- use placeholders from `.env.example`
- generated example files read credentials from environment variables
- example generation refuses to overwrite an existing file automatically

## Installation

Expand Down Expand Up @@ -88,3 +114,10 @@ There are 2 types of exceptions returned from the library:
- `detail` - Detail of exception
- `tabdeal.exceptions.ServerException`
- This is thrown when server returns `5XX`, it's an issue from server side.

## Developer checks

```bash
python -m compileall tabdeal tests
python -m unittest discover -s tests
```
64 changes: 64 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
$ErrorActionPreference = "Stop"

$projectRoot = Split-Path -Parent $MyInvocation.MyCommand.Path
$appHome = Join-Path $env:LOCALAPPDATA "TabdealPythonSDK"
$venvPath = Join-Path $appHome "venv"
$venvPython = Join-Path $venvPath "Scripts\python.exe"

function Resolve-Python {
$candidates = @(
@{ Cmd = "py"; Args = @("-3", "-c", "import sys; print(sys.executable)") },
@{ Cmd = "python"; Args = @("-c", "import sys; print(sys.executable)") }
)

foreach ($candidate in $candidates) {
try {
$resolved = & $candidate.Cmd @($candidate.Args) 2>$null
if ($LASTEXITCODE -eq 0 -and $resolved) {
return $resolved.Trim()
}
} catch {
}
}

if (Get-Command winget -ErrorAction SilentlyContinue) {
Write-Host "Python 3 was not found. Attempting installation with winget..."
winget install -e --id Python.Python.3.11 --accept-package-agreements --accept-source-agreements
return Resolve-Python
}

throw "Python 3 was not found and winget is unavailable. Please install Python 3 manually."
}

function Test-Tk {
param(
[string]$PythonExecutable
)

& $PythonExecutable -c "import tkinter" 2>$null
return $LASTEXITCODE -eq 0
}

$python = Resolve-Python

if (-not (Test-Tk -PythonExecutable $python)) {
Write-Host "Tkinter is not available in the detected Python installation."
Write-Host "Please reinstall Python with Tcl/Tk support enabled, then run this script again."
exit 1
}

New-Item -ItemType Directory -Force -Path $appHome | Out-Null

if (-not (Test-Path $venvPython)) {
Write-Host "Creating virtual environment at $venvPath"
& $python -m venv $venvPath
}

Write-Host "Upgrading pip..."
& $venvPython -m pip install --upgrade pip

Write-Host "Installing tabdeal-python from $projectRoot"
& $venvPython -m pip install --upgrade $projectRoot

Write-Host "Launching Tabdeal Quickstart..."
& $venvPython -m tabdeal
77 changes: 77 additions & 0 deletions install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
#!/usr/bin/env bash
set -euo pipefail

PROJECT_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
APP_HOME="${XDG_DATA_HOME:-$HOME/.local/share}/tabdeal-python-sdk"
VENV_PATH="$APP_HOME/venv"
VENV_PYTHON="$VENV_PATH/bin/python"

have_cmd() {
command -v "$1" >/dev/null 2>&1
}

need_sudo() {
if [[ "${EUID}" -ne 0 ]]; then
echo "sudo"
fi
}

install_prerequisites() {
local sudo_cmd
sudo_cmd="$(need_sudo)"

echo "Python 3 or Tk support is missing. Attempting a conservative install..."

if have_cmd apt-get; then
${sudo_cmd} apt-get update
${sudo_cmd} apt-get install -y python3 python3-venv python3-tk
return
fi
if have_cmd dnf; then
${sudo_cmd} dnf install -y python3 python3-tkinter
return
fi
if have_cmd yum; then
${sudo_cmd} yum install -y python3 tkinter
return
fi
if have_cmd pacman; then
${sudo_cmd} pacman -Sy --noconfirm python tk
return
fi
if have_cmd zypper; then
${sudo_cmd} zypper install -y python3 python3-tk
return
fi
if have_cmd apk; then
${sudo_cmd} apk add --no-cache python3 py3-pip py3-virtualenv tcl tk
return
fi

echo "Unsupported package manager. Install python3, python3-venv, and tkinter manually." >&2
exit 1
}

if ! have_cmd python3; then
install_prerequisites
fi

if ! python3 -c "import tkinter" >/dev/null 2>&1; then
install_prerequisites
fi

mkdir -p "$APP_HOME"

if [[ ! -x "$VENV_PYTHON" ]]; then
echo "Creating virtual environment in $VENV_PATH"
python3 -m venv "$VENV_PATH"
fi

echo "Upgrading pip..."
"$VENV_PYTHON" -m pip install --upgrade pip

echo "Installing tabdeal-python from $PROJECT_ROOT"
"$VENV_PYTHON" -m pip install --upgrade "$PROJECT_ROOT"

echo "Launching Tabdeal Quickstart..."
"$VENV_PYTHON" -m tabdeal
5 changes: 5 additions & 0 deletions tabdeal/__main__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
from tabdeal.panel import main


if __name__ == "__main__":
main()
Loading