Elena Framework for cryptocurrencies trading bots documentation
| Repository | https://github.com/Pasta-fantasia/elena-docs |
| Copyright | Apache License - 2022 - Fran Simó |
Table of Contents
Install ↵
Pure Python
Note:
This is a work in progress. It's a software configuration guide. This Is Not Financial Advice.
Pre requisites
The pure-python install assumes that you are working on a linux machine running Debian 12 (bookworm) or similar Raspberry Pi OS using Python 3.11
System libraries
Most Debian had already installed Python3 and its basics components, but you may want to run this apt installs as root or sudo:
apt update
apt install -y python3 build-essential git libssl-dev gcc python3.11-venv wget cron
Dedicated user
It's recommended to create a dedicated user. This guide also assumes that.
useradd elena2 --user-group --create-home --shell /bin/bash
Modules installation
Logged as the dedicated user, install the modules on a new virtual environment.
The modules are:
- elena: main trading lib.
- elena-basics: basic strategies ready to use.
- elena-notifications-telegram: plugin to send notifications to telegram.
python3 -m venv elena2_venv
source elena2_venv/bin/activate
pip install -U pip setuptools wheel
pip install git+https://github.com/Pasta-fantasia/elena.git@v2.4.1
pip install git+https://github.com/Pasta-fantasia/elena-basics.git@v0.1.7
pip install git+https://github.com/Pasta-fantasia/elena-notifications-telegram.git@v0.0.1
Note: if you have a previous version is recommended to uninstall elena and elena-basics before upgrading.
Create a data directory
mkdir $HOME/local_data
Create basic configuration files
cd $HOME/local_data
wget https://raw.githubusercontent.com/Pasta-fantasia/elena-docs/main/docs/assets/configs_2.3.2/config.yaml
wget https://raw.githubusercontent.com/Pasta-fantasia/elena-docs/main/docs/assets/configs_2.3.2/secrets.yaml
wget https://raw.githubusercontent.com/Pasta-fantasia/elena-docs/main/docs/assets/configs_2.3.2/strategies.yaml
Test
cd
elena

Configure bash environment
echo "source $HOME/elena2_venv/bin/activate" >> $HOME/.bashrc
echo "export ELENA_HOME=$HOME/local_data" >> $HOME/.bashrc
source $HOME/.bashrc
Configure cron
Download the cron shell script:
wget https://raw.githubusercontent.com/Pasta-fantasia/elena-docs/main/docs/assets/configs_2.3.2/cron.sh
Check that cron.sh is pointing to your Python virtual environment and ELENA_HOME by running bash cron.sh, you should find last.log file on $HOME with the same contents of the image above.
Add this line using crontab -e:
* * * * * BASH_ENV=~/.bashrc bash -c -l "bash cron.sh"
Wait for a minute, and you should find last.log file on $HOME with the same contents of the image above.
Congratulations!
Now you have the basic Elena installed. The next step is to configure the exchanges, telegram (optional) and your strategies.
Docker
Note:
This is a work in progress. It's a software configuration guide. This Is Not Financial Advice.
https://docs.docker.com/engine/install/debian/
https://docs.docker.com/engine/install/linux-postinstall/
Ended: Install
Config ↵
Exchanges
Note:
This is a work in progress. It's a software configuration guide. This Is Not Financial Advice.
Secretes overview
Binance
Telegram configuration
Note:
This is a work in progress. It's a software configuration guide. This Is Not Financial Advice.
To use Telegram notifications check this README.md
Ended: Config
Strategies ↵
Strategies
Note:
This is a work in progress. It's a software configuration guide. This Is Not Financial Advice.
Use cases - which strategy is best for you?
- DCA_Strict:
- You're a believer in crypto and you're playing very long...
- Only buys.
- Why use Elena and not your exchange "auto invest"? At least in Binance, Elena is cheaper. You can also automate in one place several exchanges.
- DCA_Conditional_Buy_LR:
- A believer that wants to avoid buying during a fall.
- Only buys.
- DCA_Conditional_Buy_LR_with_TrailingStop:
- DCA + Trailing Stop Loss.
- Buys and passive sells with stop loss.
- Check TrailingStopLoss.
- TrailingStopLoss: you want to protect your crypto holdings or incomes selling it in a fall ensuring a profit
- Passive sells with stop loss.
- You have crypto, you're holding, but you can trade a part to get a profit in the bull run.
- You have incomes in crypto, like a validator, miner, hotspot.
- You bought crypto on the previous bull run and you want to sell it with a profit, setting a minimal price. (pending to implement)
- You want to buy by your self, but after that you want to protect that asset from strong falls.
General parameters
Strategies:
- id: DCA_Strict
name: DCA_Strict
enabled: true
strategy_class: elena_basic.strategies.dca_strict.DCA_Strict
bots:
- id: DCA_BTC_USDT_1
name: DCA Strict BTC/USDT
enabled: false
pair: BTC/USDT
exchange: binance
time_frame: 1h # Valid values: 1m, 1h, 1d, 1M, 1y
cron_expression: "0,30 * * * *" # At 0 and 30 minutes of every hour
budget_limit: 600.0 # Buy up to 600 UDST
pct_reinvest_profit: 100.0 # reinvest all profits
Parameters:
- strategy_class: this chooses what strategy to use.
- bots.id: bot id, that's used as filename like DCA_BTC_USDT_1.json
- pair: uppercase string literal of a pair of currencies (as CCXT express it)
- exchange: exchange name as represented in Elena.
- time_frame: default timeframe for the candles retrival from exchange as represented in Elena
- cron_expression: cron expression that defines when the bot is going to be executed. The default installation in this guid makes Elena to execute every minute but a weekly DCA can uses something like "0 0 12 ? * SUN"
- budget_limit: sets how much can spend. 0 means no limit. On any buy the strategies check if there is budget on the bot and balance on the exchange. You can assign 100 USDT on the bot while you keep 300 USDT on the exchange.
- pct_reinvest_profit: sets, after a profitable trade, how much of that profit will become part of the budget.
DCA_Strict
On every cron execution it places a buy market order. The amount of the order is set by spend_on_order parameter and it's limited by budget.
Strategies:
- id: DCA_Strict
strategy_class: elena_basic.strategies.dca_strict.DCA_Strict
bots:
- id: DCA_BTC_USDT_1
config:
spend_on_order: 10.0
Parameters:
- spend_on_order: how much can spend on every single order, budget and balance are checked.
DCA_Conditional_Buy_LR
As DCA_Strict but it evaluates a linear regression, if the angle is positive creates the buy order, to avoid buying during a fall. lr_buy_longitude determines how many time intervals are used to calculate the angle.
In 1d time frame, lr_buy_longitude is the number of days with price going up.
Strategies:
- id: DCA_LR
strategy_class: elena_basic.strategies.dca_conditional_lr.DCA_Conditional_Buy_LR
bots:
- id: DCA_LR_BTC_USDT_1
config:
spend_on_order: 100.0
lr_buy_longitude: 5
Parameters:
- spend_on_order: how much can spend on every single order, budget and balance are checked.
- lr_buy_longitude: number of timeframe point to calculate the linear regression. In a 1d time fame is the number of days.
TrailingStopLoss
A trailing stop moves up a stop order, an order that is executed when the prices fall from a "stop loss" point and has a minimal selling price at "stop price".
Stop loss limit is shown as lb_close the blue line on the graphs. Stop price as lb_low the orange line on the graphs.
It's a conservative strategy to protect the investment.
On every run the bots will:
- Check if new coins has arrived they will start a new trade with an entry price as the current price.
- Once a trade begins the bots will check if the entry price is higher than then current "stop price" +minimal_benefit_to_start_trailing, if so, a stop order will be sent with stop loss (lb_close) and stop price( lb_low).
- For every trade already started they will check if the current calculated stop price is higher than the previous order, if so, they will cancel the old order and create a new one. The bots groups all trades in one stop order deu to some exchanges limitations.
Uses Double Exponential Moving Average (DEMA) on the Closes to calculate the stop loss. Stop price is the stop loss minus a percentage.
Why DEMA? Because it performed better on the simulations.
- id: TrailingStopLoss
name: TrailingStopLoss
enabled: true
strategy_class: elena_basic.strategies.trailing_stop.TrailingStopLoss
bots:
- id: BTC_USDT_1
name: TrailingStopLoss BTC/USDT
config:
band_length: 7
band_mult: 1
band_low_pct: 3.8906
min_price_to_start_trailing: 0.0
minimal_benefit_to_start_trailing: 0.3
asset_to_manage: 100%
Parameters:
- band_length: DEMA length. Number of data point in the time_frame defined at bot level.
- band_mult: standard deviation multiplier over band.
- band_low_pct: percentage bellow stop loss to set the stop price.
- min_price_to_start_trailing: price of the asset to start trailing
- minimal_benefit_to_start_trailing: % minimal benefit, expressed as 5%, but minimal could be 0.3%
- asset_to_manage: expressed a % or absolute is how much asset to manage.
stop_loss = dema(ohlc.close,band_length) - ( std(ohlc.close,band_length) * band_mult )
stop_price = stop_loss - band_low_pct%
band_low_pct in the examples coms from the down variance (open - low) of the price for the optimization period.
DCA_Conditional_Buy_LR_with_TrailingStop
Buys as DCA_Conditional_Buy_LR but adds a trailing stop. The trailing is the same as TrailingStopLoss but it works only with the trades that the DCA started (only DCA buys are managed)
Strategies:
- id: DCA_LR_SL...
strategy_class: elena_basic.strategies.dca_conditional_lr_trailing_stop.DCA_Conditional_Buy_LR_with_TrailingStop
bots:
- id: DCA_LR_SL_BTC_USDT_1
config:
spend_on_order: 200.0
daily_budget: 200.0
# weekly_budget: 0.0
spent_times_shift: "-5 hours"
lr_buy_longitude: 7
band_length: 34
band_mult: 2
band_low_pct: 3.8906
min_price_to_start_trailing: 0.0
minimal_benefit_to_start_trailing: 0.3
Parameters:
- spend_on_order: how much can spend on every single order, budget and balance are checked.
- daily_budget: how much to spend by day. spend_on_order = to 10, with a cron by hour will by 24 times and spend 240... unless daily_budget is set to, for example, 100 then it will buy only 100 per day. Spend by day is calculated based on the buy orders.
- weekly_budget: same as daily_budget but for week.
- spent_times_shift: -timedelta to shit the week or daily spend. Useful to start the day at 5am with "-5 hours".
- lr_buy_longitude: number of timeframe point to calculate the linear regression. In a 1d time fame is the number of days.
- band_length: DEMA length. Number of data point in the time_frame defined at bot level.
- band_mult: standard deviation multiplier over band.
- band_low_pct: percentage bellow stop loss to set the stop price.
- min_price_to_start_trailing: price of the asset to start trailing
- minimal_benefit_to_start_trailing: % minimal benefit, expressed as 5%, but minimal could be 0.3%
- asset_to_manage: expressed a % or absolute is how much asset to manage.
Configuration by example
Note:
This is a work in progress. It's a software configuration guide. This Is Not Financial Advice.
This page guides you to an example of parametrization using DCA_Conditional_Buy_LR_with_TrailingStop and TrailingStopLoss.
Lets supuse you have 1000 USDT and some old BTC and some HNT from your hotspot.
You believe in two possible scenarios for the next year: Up and Down or Range.
- TrailingStopLoss to protect or trade some already hodl crypto, BTC and HNT.
- DCA_Conditional_Buy_LR_with_TrailingStop to invest the 1000 USDT.
All config bellow are in strategies_example.yaml
TrailingStopLoss for BTC and HNT
For long term BTC configuration for the trailing is 1d timeframe and:
- band_length=34
- band_mult=2
For HNT the same configuration can be used. You can see in the graph that the sell is not triggered.
The bots will run every hour to check the status.
In both cases all the balance in the exchange will be managed by the strategy. Every time new coins arrive the bots will take them as "under protection".
If you want to combine this strategy with another trading one in the same exchange you must use absolute number on asset_to_manage. The example will use Kucoin for TrailingStopLoss and Binance for DCA_Conditional_Buy_LR_with_TrailingStop.
The configuration file for this looks like:
Strategies:
- id: TrailingStopLoss
name: TrailingStopLoss
enabled: true
strategy_class: elena_basic.strategies.trailing_stop.TrailingStopLoss
bots:
- id: BTC_USDT_1
name: TrailingStopLoss BTC/USDT
enabled: true
pair: BTC/USDT
exchange: kucoin
time_frame: 1d # Valid values: 1m, 1h, 1d, 1M, 1y
cron_expression: "0 * * * *" # At every minute
budget_limit: 0.0 # don't control budget
pct_reinvest_profit: 100.0 # reinvest all profits
tags:
- TrailingStopLoss
- bear
config: # https://elena.fransimo.info/03_strategies/DCA_Conditional_Buy_LR_with_TrailingStop/LongTerm/Binance_BTC-USDT_1d_2017-01-01_2017-01-01_2024-01-20_1526/
band_length: 34
band_mult: 2
minimal_benefit_to_start_trailing: 0.3 # % minimal benefit, expressed as 5%, but minimal could be 0.3%
asset_to_manage: 100%
- id: HNT_USDT_1
name: TrailingStopLoss HNT/USDT
enabled: true
pair: HNT/USDT
exchange: kucoin
time_frame: 1d # Valid values: 1m, 1h, 1d, 1M, 1y
cron_expression: "0 * * * *" # At every minute
budget_limit: 0.0 # don't control budget
pct_reinvest_profit: 100.0 # reinvest all profits
tags:
- TrailingStopLoss
- bear
config: # https://elena.fransimo.info/03_strategies/DCA_Conditional_Buy_LR_with_TrailingStop/HNT/KuCoin_HNT-USDT_1d_2023-06-16_2023-06-16_2024-01-21_1731/
band_length: 34
band_mult: 2
minimal_benefit_to_start_trailing: 0.3 # % minimal benefit, expressed as 5%, but minimal could be 0.3%
asset_to_manage: 100%
DCA_Conditional_Buy_LR_with_TrailingStop to invest the 1000 USDT
With the 1000 USDT on Binance, 500 will trade with BTC and 500 on ETH.
All configration will spend 100 USDT each time.
For BTC:
- lr_buy_longitude: 7
- band_length: 34
- band_mult: 2
From the experiment.
You split the 500 on ETH in two parametrization:
- Range (from the experiment)
- lr_buy_longitude: 6
- band_length: 11
- band_mult: 1
- Up_and_down (from the experiment)
- lr_buy_longitude: 2
- band_length: 55
- band_mult: 2
Optimization are only a guide and are based on history. The ETH Range optimization is band_length: 11, band_mult: 1, but it also says dca_budget=1600, buy_all_days=0. That means use all your budget once a week. The example bellow uses only 100 USDT per day.
Before using any bot with any configuration is better your check at least the simulation by your self, and then, if the parameters are compatible run it in the exchange test environment.
Strategies:
- id: DCA_LR_SL
name: DCA_LR_SL
enabled: true
strategy_class: elena_basic.strategies.dca_conditional_lr_trailing_stop.DCA_Conditional_Buy_LR_with_TrailingStop
bots:
- id: DCA_LR_SL_BTC_USDT_1
name: DCA Conditional LR with Trailing Stop Loss BTC/USDT
enabled: false
pair: BTC/USDT
exchange: binance
time_frame: 1d # Valid values: 1m, 1h, 1d, 1M, 1y
cron_expression: "0 5 * * *" # At 5am each day
budget_limit: 500.0 # Buy up to 500 UDST
pct_reinvest_profit: 100.0 # reinvest all profits
tags:
- DCA
- bull
config: # https://elena.fransimo.info/03_strategies/DCA_Conditional_Buy_LR_with_TrailingStop/Up_and_down/Binance_BTC-USDT_1d_2019-11-01_2019-11-01_2024-01-20_1523/
spend_on_order: 100.0 # spend 100 USDT on every cycle
lr_buy_longitude: 7 # data points for linear regression
band_length: 34
band_mult: 2
minimal_benefit_to_start_trailing: 0.3 # % minimal benefit, expressed as 5%, but minimal could be 0.3%
- id: DCA_LR_SL_ETH_USDT_1
name: DCA Conditional LR with Trailing Stop Loss BTC/USDT
enabled: false
pair: ETH/USDT
exchange: binance
time_frame: 1d # Valid values: 1m, 1h, 1d, 1M, 1y
cron_expression: "0 5 * * *" # At 5am each day
budget_limit: 250.0 # Buy up to 250 UDST
pct_reinvest_profit: 100.0 # reinvest all profits
tags:
- DCA
- ranging
config: # https://elena.fransimo.info/03_strategies/DCA_Conditional_Buy_LR_with_TrailingStop/Range/Binance_ETH-USDT_1d_2022-06-16_2022-06-16_2024-01-20_1612/
spend_on_order: 100.0 # spend 100 USDT on every cycle
lr_buy_longitude: 6 # data points for linear regression
band_length: 11
band_mult: 1
minimal_benefit_to_start_trailing: 0.3 # % minimal benefit, expressed as 5%, but minimal could be 0.3%
- id: DCA_LR_SL_ETH_USDT_2
name: DCA Conditional LR with Trailing Stop Loss BTC/USDT 2
enabled: false
pair: ETH/USDT
exchange: binance
time_frame: 1d # Valid values: 1m, 1h, 1d, 1M, 1y
cron_expression: "0 5 * * *" # At 5am each day
budget_limit: 250.0 # Buy up to 250 UDST
pct_reinvest_profit: 100.0 # reinvest all profits
tags:
- DCA
- bull
config: # https://elena.fransimo.info/03_strategies/DCA_Conditional_Buy_LR_with_TrailingStop/Up_and_down/Binance_ETH-USDT_1d_2019-11-01_2019-11-01_2024-01-20_1609/
spend_on_order: 100.0 # spend 100 USDT on every cycle
lr_buy_longitude: 2 # data points for linear regression
band_length: 55
band_mult: 2
minimal_benefit_to_start_trailing: 0.3 # % minimal benefit, expressed as 5%, but minimal could be 0.3%
General conservative configuration
The only real way to configure your strategies is to try the parameters your self using the experiments' repo notebooks.
The results here always come with a heat map, an ordered by return set of results that show all posible combination of parameters.
As mentioned above, optimization are only a guide based on history.
All that said, over a lot of simulations one repeats very ofter:
time_frame: 1d # Valid values: 1m, 1h, 1d, 1M, 1y
cron_expression: "0 5 * * *" # At 5am each day
config:
spend_on_order: 100.0 # spend 50 on bear, 100 on range, more only if you're absolute sure.
lr_buy_longitude: 7 # or 6
band_length: 34 # for long term and trusted assets
band_mult: 2
# band_length: 13 # for short term or risk reduction
# band_mult: 1
Experiments ↵
DCA_Conditional_Buy_LR_with_TrailingStop
Note:
This is a work in progress. It's a software configuration guide. This Is Not Financial Advice.
Experiment's source code can be found here.
Scenarios and best results for BTC
DCA_Conditional_Buy_LR_with_TrailingStop works better on 1 day timeframe in any scenario. It took thousands of test sampling ranging dates to discard minute and hourly trading for this strategy.
Sampling moving and overlapping dates helped to reduce the parameters space.
Range
From: 2022-06-16 to 2023-03-10.
Optimized parameters
- band_length=3
- band_mult=1
- band_low_pct=2.065553230602729
- minimal_benefit_to_start_trailing=1.003
- reinvest=2
- dca_budget=1000
- buy_all_days=0
- lr_buy_longitude=6
Results
- Return: 36.37531513528706% over -1.2284505259711431% on buy and hold.
- Initial investment: 1000.0
- Final result: 1363.7531513528706
Up and Down
From 2019-11-01 to 2022-01-23.
Optimized parameters
- band_length=34
- band_mult=2
- band_low_pct=3.0025190627892058
- minimal_benefit_to_start_trailing=1.003
- reinvest=2
- dca_budget=100
- buy_all_days=1
- lr_buy_longitude=10
Results
- Return: 965.4840942441458% over 292.6135311175407% on buy and hold.
- Initial investment: 1000.0
- Final result: 10654.840942441459
Bear
From 2021-11-12 to 2022-11-12.
Optimized parameters
- band_length=3
- band_mult=1
- band_low_pct=2.8111930348691905
- minimal_benefit_to_start_trailing=1.003
- reinvest=2
- dca_budget=50
- buy_all_days=0
- lr_buy_longitude=11
Results
- Return: -9.49249976588443% over -73.78119881357838% on buy and hold.
- Initial investment: 1000.0
- Final result: 905.0750023411557
Long Term
From 2017-01-01 to 2024-01-20.
Optimized parameters
- band_length=34
- band_mult=2
- band_low_pct=2.815263919591264
- minimal_benefit_to_start_trailing=1.003
- reinvest=2
- dca_budget=100
- buy_all_days=1
- lr_buy_longitude=7
Results
- Return: 1487.0788390592738% over 904.5432166669% on buy and hold.
- Initial investment: 1000.0
- Final result: 15870.788390592737
BTC
Bear
Binance_BTC-USDT_1d_2021-11-12_2021-11-12_2024-01-20_1525
Binance_BTC-USDT_1w_2021-11-12_2021-11-12_2024-01-20_1542
Range
Binance_BTC-USDT_1d_2022-06-16_2022-06-16_2024-01-20_1515
Binance_BTC-USDT_1w_2022-06-16_2022-06-16_2024-01-20_1537
Up and down
Binance_BTC-USDT_1w_2019-11-01_2019-11-01_2024-01-20_1555
Binance_BTC-USDT_1d_2019-11-01_2019-11-01_2024-01-20_1523
Binance_BTC-USDT_1h_2019-11-01_2019-11-01_2024-01-20_1556
Long Term
Binance_BTC-USDT_1w_2017-01-01_2017-01-01_2024-01-20_1543
Binance_BTC-USDT_1d_2017-01-01_2017-01-01_2024-01-20_1526
ETH
Bear
Binance_ETH-USDT_1d_2021-11-12_2021-11-12_2024-01-20_1611
Range
Binance_ETH-USDT_1d_2022-06-16_2022-06-16_2024-01-20_1612
Up_and_down
Binance_ETH-USDT_1d_2019-11-01_2019-11-01_2024-01-20_1609
Long Term
Ended: Experiments
Ended: Strategies
Roadmap
High level roadmap
Task Details
Task details can be found in the Github project
Resources
Donate
| Network | Address |
|---|---|
| Ethereum | |
| Bitcoin | |
| Tezos | |
| Litecoin | |
| DOGE | |
| Ploygon | |
| Dash | |
| Zcash | |
| Monero |
About ↵
Team
Note:
This is a work in progress
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
-
Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
-
Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
-
Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
-
Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
-
Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
-
Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
-
Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
-
Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.



