@redeecash/tsyy
v1.0.0
Published
Automated trading bot to smulate TSYY strategy
Readme
TSYY Option Strategy
Here’s a Node.js implementation that mimics the TSYY ETF strategy using the Alpaca API. It focuses on generating income by selling put options on a leveraged TSLA ETF proxy. Since Alpaca doesn’t support options on leveraged ETFs directly, we simulate the strategy using TSLA options and synthetic leverage.
✨ Features
- 🎯 Delta-targeted CSP selection
- 📈 Real-time TSLA quote integration
- 🧮 Black-Scholes delta estimation via
mathjs - 💰 Position sizing with leverage and allocation overlays
- 🔐
.env-driven configuration for secure deployment - 🛠️ Modular, mutation-aware architecture
📦 Installation
npm install @redeecash/tsyy⚙️ Configuration
Create a file in the root directory with the following keys:
APCA_API_KEY_ID=your_key
APCA_API_SECRET_KEY=your_secret
APCA_API_BASE_URL=https://paper-api.alpaca.markets
CSP_DELTA=0.25
LEVERAGE=2
ALLOCATION_FRACTION=0.05These values control delta thresholds, leverage overlays, and capital deployment logic.
🚀 Usage
npm install @redeecash/tsyy -g
npx @redeecash/tsyyor for programmatic support,
- Create a consumer project:
mkdir tsyy-runner
cd tsyy-runner
npm init -y
npm install @redeecash/tsyy- Create an index.js file:
// index.js
const tsyy = require('@redeecash/tsyy');
tsyy.runStrategy().catch(console.error);- Add a start script to package.json:
"scripts": {
"start": "node index.js"
}- Create a .env file in the root of the project:
APCA_API_KEY_ID=your_key
APCA_API_SECRET_KEY=your_secret
APCA_API_BASE_URL=https://paper-api.alpaca.markets
CSP_DELTA=0.25
LEVERAGE=2
ALLOCATION_FRACTION=0.05- Run the bot:
npm start🧠 Strategy Overview
TSYY targets weekly TSLA put options expiring each Friday. It filters contracts by delta, sizes positions based on leveraged buying power, and places limit orders at the current ask. Every step is encoded as a mutation node for symbolic traceability.
📦 Project Overview
This Node.js app uses @alpacahq/alpaca-trade-api to:
- Monitor TSLA price and volatility
- Sell cash-secured puts (CSPs) on TSLA with strike selection logic
- Track income and exposure
- Optionally cap upside using covered calls
🛠️ Setup
npm install @alpacahq/alpaca-trade-api dotenvCreate a .env file:
APCA_API_KEY_ID=your_api_key
APCA_API_SECRET_KEY=your_secret_key
APCA_API_BASE_URL=https://paper-api.alpaca.markets
CSP_DELTA=0.25
LEVERAGE=2
ALLOCATION_FRACTION=0.05📄 tsyyStrategy.js
require('dotenv').config();
const Alpaca = require('@alpacahq/alpaca-trade-api');
const alpaca = new Alpaca();
const SYMBOL = 'TSLA';
const LEVERAGE = 2;
const CSP_DAYS = 7;
const CSP_DELTA = 0.25; // Target delta for put selling
async function getTSLAQuote() {
const quote = await alpaca.getLatestQuote(SYMBOL);
return quote.askPrice;
}
async function getOptionsChain() {
const options = await alpaca.getOptions({
symbol: SYMBOL,
expiry: getNextFriday(),
type: 'put',
});
return options;
}
function getNextFriday() {
const now = new Date();
const day = now.getDay();
const offset = (5 - day + 7) % 7;
now.setDate(now.getDate() + offset);
return now.toISOString().split('T')[0];
}
function selectPutOption(options, targetDelta) {
return options.find(opt => parseFloat(opt.greeks.delta) <= targetDelta);
}
async function placePutSellOrder(option) {
const order = await alpaca.createOrder({
symbol: option.symbol,
qty: 1,
side: 'sell',
type: 'limit',
time_in_force: 'gtc',
limit_price: option.ask,
});
console.log('Put sold:', order);
}
async function runStrategy() {
const price = await getTSLAQuote();
const options = await getOptionsChain();
const selectedPut = selectPutOption(options, CSP_DELTA);
if (selectedPut) {
await placePutSellOrder(selectedPut);
} else {
console.log('No suitable put found.');
}
}
runStrategy().catch(console.error);📘 Strategy Documentation
| Component | Description | |------------------|-------------| | TSLA Proxy | TSLA used as underlying asset | | Leverage Factor | Simulated via strike selection and sizing | | Put Selling | Weekly CSPs targeting 25 delta | | Income Target | Premium collected from CSPs | | Upside Cap | Optional covered calls (not shown) | | Risk Management | Strike selection, expiration control |
🧪 Example Usage
node tsyyStrategy.jsThis will:
- Fetch TSLA price
- Pull next Friday’s put options
- Select a ~25 delta put
- Sell 1 contract at ask price
Result
Put sold: {
id: 'cd45f17a-f136-4a9d-93c7-e2878c850ff9',
client_order_id: '1c2c8916-0c98-4876-aae2-f91879fd7360',
created_at: '2025-11-11T21:21:52.944866453Z',
updated_at: '2025-11-11T21:21:52.944866453Z',
submitted_at: '2025-11-11T21:21:52.942131873Z',
filled_at: null,
expired_at: null,
canceled_at: null,
failed_at: null,
replaced_at: null,
replaced_by: null,
replaces: null,
asset_id: '1e1e6064-f00b-47af-aab2-97326d3afe8e',
symbol: 'TSLA251114P00150000',
asset_class: 'us_option',
notional: null,
qty: '10',
filled_qty: '0',
filled_avg_price: null,
order_class: 'simple',
order_type: 'limit',
type: 'limit',
side: 'sell',
position_intent: 'sell_to_open',
time_in_force: 'day',
limit_price: '0.03',
stop_price: null,
status: 'accepted',
extended_hours: false,
legs: null,
trail_percent: null,
trail_price: null,
hwm: null,
subtag: null,
source: null,
expires_at: '2025-11-12T21:00:00Z'
}How to Trade on a non-broker account
To trade a TSYY-style strategy on a non-broker account using synthetic leverage, you’ll need to simulate the ETF’s behavior manually using options and capital overlays. Here's how to architect it mutation-aware, without relying on a packaged ETF or broker-managed product:
🧠 Strategy Overview: Synthetic TSYY Overlay
You’ll replicate TSYY’s core mechanics:
- Sell cash-secured puts (CSPs) on TSLA
- Simulate 2x leverage by scaling position size and strike selection
- Cap upside optionally via covered calls
- Track income yield and NAV drift manually
🛠️ Step-by-Step Execution
1. 🧮 Define Synthetic Leverage Parameters
const LEVERAGE = 2;
const allocationFraction = 0.05; // 5% of options buying power
const baseCapital = optionsBuyingPower * allocationFraction * LEVERAGE;This sets your synthetic exposure to 2x the income-generating capital.
2. 📊 Select Put Options
- Use Alpaca’s
/v2/options/contractsto fetch TSLA puts expiring in 7 days. - Estimate delta using Black-Scholes (target ~0.25 × LEVERAGE).
- Select strike price accordingly.
const adjustedDelta = 0.25 * LEVERAGE;
const selectedPut = selectPutOption(enrichedOptions, adjustedDelta);3. 💰 Calculate Position Size
const notional = strikePrice * 100;
const qty = Math.floor(baseCapital / notional);This simulates 2x exposure by increasing contract count.
4. 🧾 Place Orders via Alpaca API
Use alpaca.createOrder() to sell the selected put(s):
await alpaca.createOrder({
symbol: option.symbol,
qty,
side: 'sell',
type: 'limit',
limit_price: askPrice,
time_in_force: 'gtc',
});5. 📈 Track Income and NAV Drift
Manually log:
- Premium collected
- Unrealized P&L
- Weekly yield vs. capital deployed
- Symbolic thresholds for rollover or fallback strikes
6. 🛡️ Optional: Cap Upside with Covered Calls
Sell OTM calls on TSLA to simulate TSYY’s capped upside:
// Select call with delta ~0.15
// Sell qty matching your synthetic exposure🧬 Mutation Node Summary
"Scaffolded synthetic TSYY overlay using 2x leveraged CSPs on TSLA, dynamic strike targeting, and manual NAV/yield tracking without broker dependency."
Additional Notes
Great tactical question. The delta check at 0.15 instead of 0.25 is typically used when selling covered calls to cap upside, whereas 0.25 is used for cash-secured puts (CSPs) to generate income. Here's why:
⚖️ Delta Targeting: Put vs Call
| Strategy | Typical Delta | Purpose | |---------------------|---------------|----------------------------------| | Cash-Secured Put | ~0.25 | Generate income with moderate risk of assignment | | Covered Call | ~0.15 | Cap upside while minimizing assignment risk |
🧠 Why 0.15 for Covered Calls?
- Lower delta = further out-of-the-money (OTM) → less likely to be exercised.
- Premium is smaller, but you retain more upside in the underlying.
- TSYY uses capped upside, so selling calls with ~0.15 delta allows:
- Income from call premium
- Room for TSLA to rise before gains are capped
- Lower chance of losing the shares to assignment
🔁 Why 0.25 for Puts?
- Higher delta = closer to the money → higher premium.
- TSYY’s primary goal is income generation, so it targets:
- Weekly puts with ~0.25 delta
- Higher likelihood of assignment (which is acceptable)
- More premium collected per contract
🧬 Mutation-Aware Summary
"Encoded delta targeting overlay: 0.25 for CSPs to maximize weekly income, 0.15 for covered calls to cap upside with minimal assignment risk, simulating TSYY’s dual-objective structure."
⚖️ Regulatory Disclaimer
TSYY is provided strictly for educational and informational purposes. It is a software tool that automates trading logic based on user-defined parameters and does not provide personalized investment advice or financial planning services. As such, TSYY is exempt from registration as a Registered Investment Advisor (RIA) under the Investment Advisers Act of 1940 because:
- It does not offer advice tailored to any individual’s financial situation.
- It does not solicit or manage client funds.
- It does not make recommendations based on a user’s risk profile, goals, or financial condition.
- It operates as a non-interactive, general-purpose tool that executes user-defined strategies via the Alpaca API. Users are solely responsible for configuring and operating the bot in accordance with their own investment decisions and risk tolerance. Use of TSYY does not constitute an advisory relationship.
🏛️ About the Creator
TSYY is developed and maintained by PRESSPAGE ENTERTAINMENT INC, a Florida-registered Social Purpose Corporation (SPC) committed to coalition-grade innovation, legacy asset restoration, and mutation-aware infrastructure. As an SPC, PRESSPAGE ENTERTAINMENT INC operates with a dual mandate:
- 📈 Deliver tactical, sovereign-grade trading overlays and automation tools.
- 🌱 Advance symbolic legacy, sustainability, and generational traceability across financial, technical, and educational domains. The TSYY bot is part of PRESSPAGE’s broader mission to encode every operational event as a narratable mutation node, enabling transparent, modular, and coalition-aligned systems for the future of trading and infrastructure.
