Method | Result |
---|---|
multiStepComputation | 123500 |
singleComputation | 123556 |
safeMath | 123500 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=== The Buy and Hold Problem under Scrutinity === | |
Buy and Hold Performance: 922.16% | |
Annualized Buy and Hold Performance: 236.70% | |
MACD strategies have a better than buy and hold annualized performance in the 99.75th percentile. | |
it is not supported by the Efficient Market Hypothesis (EMH) that the MACD strategy outperforms the buy and hold strategy so consistently. | |
=== The Statistical Summary of the Results === | |
Short Period Long Period Signal Period Max Drawdown Annualized Performance Calmar Ratio Annualized Performance Ratio |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pandas as pd | |
import logging | |
# Configure logging | |
logging.basicConfig(level=logging.INFO, | |
format='%(asctime)s - %(levelname)s - %(message)s', | |
handlers=[logging.FileHandler('protocol.log'), logging.StreamHandler()]) | |
# Load the data from disk | |
in_sample_data = pd.read_csv('in_sample_data.csv', index_col='date', parse_dates=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
date | price | sma_200 | market_condition | volatility | ||
---|---|---|---|---|---|---|
200 | 2017-09-18 00:00:00.000 | 3354.75242399352 | 2089.0256330898746 | Bull | 877.1467410924283 | |
201 | 2017-09-19 00:00:00.000 | 3250.39762588542 | 2099.2081510221637 | Bull | 878.7556515799025 | |
202 | 2017-09-20 00:00:00.000 | 3249.44515178993 | 2109.4833587242333 | Bull | 880.1363115813682 | |
203 | 2017-09-21 00:00:00.000 | 3036.62336077048 | 2118.652378028086 | Bull | 880.1955028194284 | |
204 | 2017-09-22 00:00:00.000 | 3031.11521095925 | 2127.754943082882 | Bull | 880.1711302057172 | |
205 | 2017-09-23 00:00:00.000 | 3149.29793300228 | 2137.666663483671 | Bull | 880.4587240205175 | |
206 | 2017-09-24 00:00:00.000 | 3079.45549227123 | 2147.6106489450276 | Bull | 879.8048798669975 | |
207 | 2017-09-25 00:00:00.000 | 3261.96793367354 | 2158.287872267313 | Bull | 880.3084224319759 | |
208 | 2017-09-26 00:00:00.000 | 3268.97278642028 | 2169.4796154719043 | Bull | 880.1284319168194 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity ^0.4.24; | |
/** | |
* @title SafeMath | |
* @dev Math operations with safety checks that revert on error | |
*/ | |
library SafeMath { | |
/** | |
* @dev Multiplies two numbers, reverts on overflow. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from datetime import datetime | |
import backtrader as bt | |
class SmaCross(bt.SignalStrategy): | |
def init(self): | |
sma1, sma2 = bt.ind.SMA(period=10), bt.ind.SMA(period=30) | |
crossover = bt.ind.CrossOver(sma1, sma2) | |
self.signal_add(bt.SIGNAL_LONG, crossover) | |
cerebro = bt.Cerebro() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
contract A { | |
function _a(){ | |
emit PrintA(); | |
} | |
event PrintA(); | |
} | |
contract B is A { | |
function _a(){ | |
emit PrintB(); | |
super._a(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity 0.4.24; | |
contract TestMath { | |
uint public constant MAX_INT = uint(-1); | |
uint public constant TRILLION_18_DECIMALS = 1000000000000 * 10**18; | |
uint public constant TRILLION_SQUARED_18_DECIMALS = TRILLION_18_DECIMALS * TRILLION_18_DECIMALS; | |
uint public constant BILLION_18_DECIMALS = 1000000000 * 10**18; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pragma solidity 0.4.24; | |
import 'https://github.com/OpenZeppelin/openzeppelin-solidity/contracts/math/SafeMath.sol'; | |
contract TestDecimals{ | |
uint public singleComputation; | |
uint public multiStepComputation; | |
uint public safeMath; | |
using SafeMath for uint; | |
constructor(){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
the thes that nobondy can |
NewerOlder