6 releases

new 0.2.1 May 30, 2024
0.2.0 May 12, 2024
0.1.3 Dec 28, 2023
0.1.2 Nov 4, 2023
0.1.1 Sep 30, 2023

#189 in Configuration

Download history 7/week @ 2024-02-25 10/week @ 2024-03-10 6/week @ 2024-03-17 25/week @ 2024-03-31 168/week @ 2024-05-12 18/week @ 2024-05-19

186 downloads per month

MIT and GPL-3.0-or-later

190KB
5.5K SLoC

greed

Greed is a tool for automating trades 📈

Note: Use at your own risk! This tool is in active development and may have bugs!

Investment Platforms

Currently, Greed supports the following investment platforms:

Credentials

Alpaca

To use Alpaca add the following variables to your environment:

export APCA_API_KEY_ID='<live_key_id>'
export APCA_API_SECRET_KEY='<live_secret_key>'

# The below can be used for paper trading. Invoke greed with -s to use paper trading.
export SIMULATED_APCA_API_KEY_ID='<paper_key_id>'
export SIMULATED_APCA_API_SECRET_KEY='<paper_secret_key>'

Running Greed 🚀

To run Greed in a simulated environment, you can use the following command:

greed run -s <path_to_config>

To run Greed in a live environment, you can use the following command:

greed run <path_to_config>

Configuration

# The interval between each strategy run in seconds
interval = 300
# The platform to use for trading (alpaca)
platform = "alpaca"

[[strategies]]
# Each strategy can have an optional name
name = "ETF"

# Each stategy has for, when and do rules.
# In the following example we are buying $VTI when it is below the median price by 5% and selling when the gain is above 5%
[strategies.buy]
for = { stock = "$VTI" }
when = { below_median_percent = 5.0 }
do = { buy_percent = 10 }

# You can have as many strategies as you'd like in a single configuration.
[strategies.sell]
for = { stock = "$VTI" }
when = { gain_above_percent = 5.0 }
do = { sell_all = true }

[[strategies]]
name = "Chaos"

[strategies.buy]
for = { stock = "$UVXY" }
when = { below_median_percent = 2.0, median_period = "week" }
do = { buy_percent = 5 }

[strategies.sell]
for = { stock = "$UVXY" }
when = { gain_above_percent = 3.0 }
do = { sell_all = true }

Dependencies

~12–25MB
~401K SLoC