Category Archives: Trading

sellbuy-o-meter

The Golden Ratio Multiplier Trading Algorithm

This post covers a trading algorithm developed in Python code that uses Fibonacci numbers to set levels to trade off of. It is not a short term strategy, however it is a long-term strategy more of an investment strategy. It is based on a post by Philip Swift on https://www.lookintobitcoin.com/charts/golden-ratio-multiplier/

And he also has an original article on it on medium.

https://medium.com/@positivecrypto/the-golden-ratio-multiplier-c2567401e12a?sk=e38c4eff4357a1131bed57a3f4b3eeae

I have code for this here:

cbpro-cli-tools

Theory

The golden ratio multiplier is a great indicator, visually easy to confirm and makes a lot of sense on how it works. Best of all no fussy back-testing with parameter tweaks, you just need your eyes. I like how Josh Olszewicz  added the centerline, that is a nice addition. His video was a pleasant and positive surprise that I used to review the working of the golden ratio multiplier. I started using this indicator in early 2020.

On top of the basics that are covered by Phillip Swift , I have made some additions to the it that will work well in algorithmic form to allow it to run with constraints as code. Constraints are needed to allow it to pick the correct points to enter and exit along the curve. The method of (Dollar Cost Averaging) DCAing in and out is to use 20SMA BBands (Bollenger Bands) as a point to trigger DCA, using this as a filter to trigger on price exceeding lower/upper BBand. This tweak is based on the fact that I wrote code around this and was looking for a good way for when it should reasonably DCA, versus just triggering on a crossing the Fib # * YearlySMA (SMA, Simple Moving Average), or DCAing daily when under/above this line. As far as amounts to DCA, generally with accumulate/distribute investing, I tend to compound the trades in a way that accumulates heavier as distance increases below the YearlySMA line and distributes heavier as it goes further above the target Fib # * YearlySMA. The trading scaler used is a logistic curve , with n being the ratio of the current price to the yearly avg for buys (For sales ‘n’ is inverted by n being subtracted from the target Fib level multiplier + 1, which positions the curve out to where it scales up until it reaches the next higher Fib # and back down. Using the logistic curve formula (1+k)/(k + n^e) as a trade multiplier, for example with k=0.2 and e=4, it DCA’s in around 2x at the 0.8 * yearlySMA point,, 4x at 0.5…never more than 6x as it approaches that as a limit as n –> 0. I am planning publishing this code and documentation around it and will cite your video in it when I do.

Golden Ratio Multiplier Tutorial

Also Josh Olszewicz has a video tutorial on YouTube about this particular indicator using it with TradingView code it is a worth taking me 10 minutes or so to review this as background material along with looking at https://www.lookintobitcoin.com/charts/golden-ratio-multiplier/ and the original medium article . I am going to try to stick to the essence of the code and not so much the background material which could be read in viewed in those locations.

Code

This code is light weight and can be run on a Raspberry Pi as well as a Linux PC. It requires Python 3 as this is needed for the API.

The code is designed to use the Coin Base Pro API, however there is a middle layer that interfaces with the API via cbpro_buy_sell.py  If someone wants to interface with another API this just needs to be modified to make the proper calls into another exchange as an API on the back end of it. Think of it as a thin interface layer that goes between the code and the API itself.

cbpro-cli-tools

Dependancy : One import

this would be the import cbpro code that constitutes the module for the CV pro interface API.

Other Internal Dependancies

There are a few dependencies in the code thankfully they are local dependencies. The intent was to make this code as freestanding as possible without having to import various library’s other than what is barely necessary to make it operate. The first is a file called coretamodule.py. It holds a lot of functions that are used in multiple algorithm some of which will be used in the code to implement the golden ratio multiplier which is known as the arc just Python. The other necessary dependency is a piece of code that calls for polls periodically the CB pro ticker to add prices and volumes to aC SV file. This is run from some thing like Cron on a regular basis hourly daily five minutes what have you it is run at the same rate as a fib-ad high is run calling this code 1st to fill in the CSV file which will be read in by fib active high. I will try to make this publicly available on a site where it could  be pulled down with that lease this up to the current days data. Current days data

Core concepts

The idea of the code is that a 350 day moving average is calculated.This forms the basis of the ratio that is the golden ratio between the average and the price itself. When the price is below a threshold which is coded in to a dictionary of two pools as one. When below this level it will accumulate in the particular currency pair. There is another number in this threshold when it is above this ratio of price to 350 day moving average price. this forms the basis of the ratio that is the golden ratio between the average and the price itself. When the price is below a threshold which is coded in to a dictionary of tuples as one. When below this level it will accumulate in the particular currency pair. There is another number in this threshold when it is above this ratio of price to 350 day moving average price.above this range it will distribute the currency pair. Some fine tuning is made when it is above or below the threshold. The fine-tuning is based on Bollinger bands when it is touching the bottom bands in the Bollinger band 20 day bands and the minimum price for the 20 day period is also the same as this the price they buy is initiated.C onversely for the sale when the price is at the upper edge of the Bollinger band and the maximum price for the 20 day. Has been hit as a target a sale is initiated. This makes it dollar cost average in and out on a periodic basis. The idea is to have extra filtering to kind of find a peek in the valley of price movement without DCA (Dollar Cost Average) in too much or out too much.

defines.py

there is also a dependency file called defines.py this file has the portfolio amount in it. Now it is being dynamically allocated by using the cbpro_read_accts.py.  It will scale the amount of USD traded however BTC an ETH have to be adjusted within the main function to pick values that are comfortable and proper for the trading circumstances. This allows for configuration between all of the pairs.Also in the defines file you will have to enter the key passphrase and be 64 secret, this will allow the trades to occur through the API as this is passed on by the main code.

 

Also in the defines file you will have to enter the key passphrase and be 64 secret, this will allow the trades to occur through the API as this is passed on by the main code.

 

 

Outputs and Logs

The output from the code is interpret able humanly to understand what is going on as well. There are rose of prices after the initial currency pairs listed these prices represent the various thresholds at the end it states whether it is holding or not and also what the threshold and target are the threshold being the Bollinger bands edge and the target being the lowest to highest price for the 28th time.Additionally there are log files created when the code runs there are several that are verbose and specific to a underlying currency and there is one summary file. The verbose files contain the returned output from the API function call which is a dictionary of values return from CB pro. There will also appear within the non-verbose output as a message usually relates to some thing that needs to be corrected possibly a bug or some thing like insufficient funds. This is driven by the message key from the CB Pro API return dictionary.

 

The code makes every  attempt to avoid this because it uses limit orders and it also checks the balances in the supply. The underlying currency and the to be bought or sold currency itself.

Compounding Positions

There is also a logistic scaler in this code. The logistics scaler works by increasing the amount of currency bought when the price falls below the threshold of the golden ratio multiplier which is by default one. This allows increasing the amount purchased automatically but also reaches a limit as the ratio between the price and the 350 day moving average approaches zero. It will go to a limiting constant. The opposite is true for cells there is the threshold that is coded into the dictionary of tuples the logistic scaler takes in that value plus one informs a curve that goes from the upper threshold to all 1+ this value and increases the amount sold after this plus one position it will decrease once again to zero. The idea is that it scales out hard as the price rises but has a limiting factor if it rises above the threshold too far. The idea would be to manually address these thresholds to what is expected of the currency. So periodically maintenance might be required on the threshold or they might just be a set it and forget it for some people. This all depends on how you want to invest.

 

As the price rises but has a limiting factor if it rises above the threshold too far. The idea would be to manually address these thresholds to what is expected of the currency. So periodically maintenance might be required on the threshold or they might just be a set it and forget it for some people. This all depends on how you want to invest.The default or one and two in a two pole for every currency pair. It is possible to adjust days as needed. It is also possible to adjust the logistics scaler Constants which are KNEE is the exponential constant which controls the rate of rise of the curve and key controls the multiplier affect in the amount that would be traded in the limit.

Outer Loop

The code works by looping through a list actually a dictionary of underlying currencies US D/ETH/BTC as underlyings. Then there is a function call and the inner currencies are called in a loop these other currencies that are actually traded against the underlying currencies. This allows money currency pairs to be traded and others to be added in the future.

CSV Data Collection using API

The caveat here is that there has to be enough data in the CSV file to go back for the time. And if a currency one is to be added it has to be attitude there to harvest the ticker data. I suppose in theory it would be possible to fit all data into the file itself to add a prior prior currency that’s been running in the ticker for a while if someone is motivated not to do that. Having this code in a folder and having it called by Cron preferably using a script calling the script first then harvesting the price volume data then calling for code it will work seamlessly as a plug and play algorithm. Because it is using the golden ratio multiplier there is no need for back testing as this has been proven out to work by Philip Smith Swift in his presentation and write up online.

Obviously this code could be modified in anyway the 350 day. Could be changed to something else along with the 20 day Bollinger band. And the threshold as I said earlier our configurable.

 

 

 

 

Misato Katsuragi

Kelly Criterion

If money is your bread then nothing else matters.

The Kelly Criterion is something anyone who trades, invests or even gambles must know. I have a brief summary below and some additional resources at the end of the summary.

There is also a great book devoted to this topic, Fortune’s Formula by William Poundstone, a must have book for any serious investor.

The Kelly Criterion, also known as the Kelly strategy, Kelly formula, or Kelly bet, is a mathematical formula designed to help people determine the optimal size of a series of bets. It’s named after John L. Kelly, Jr., who introduced the concept in a 1956 paper titled “A New Interpretation of Information Rate.”

The Kelly Criterion is commonly used in gambling, investing, and other areas where decisions involve uncertainty and risk. The goal of the Kelly Criterion is to maximize the long-term growth of capital by finding the optimal fraction of capital to invest in each opportunity.

The basic formula for the Kelly Criterion is:

Kelly-Critierion
Kelly-Critierion

The formula tells you what percentage of your current capital should be invested in a particular opportunity, given your assessment of the probability of success and the odds being offered.

It’s important to note a couple of things about the Kelly Criterion:

1. Risk of Ruin: The Kelly Criterion can be aggressive. Betting too much of your capital, even with a positive expectation, can lead to significant losses. The criterion doesn’t consider the risk of ruin, which is the risk of losing your entire capital.

2. Estimates are Crucial: The accuracy of the criterion depends heavily on the accuracy of your probability estimates. If your estimates are inaccurate, the strategy might not perform well.

3. Logarithmic Utility: The formula assumes logarithmic utility, meaning that the investor’s goal is to maximize the expected logarithm of wealth. This utility function helps to balance between risk and reward.

To use the Kelly Criterion, you would apply the formula to each opportunity, and the resulting fraction represents the proportion of your current capital that you should invest.

Keep in mind that many variations and adaptations of the Kelly Criterion exist to address specific situations and concerns. It’s a tool that requires careful consideration and understanding of the underlying assumptions and risks.

 

To learn more, see these resources

https://www3.cs.stonybrook.edu/~skiena/691/2007/lectures/Kelly.pdf

http://r6.ca/blog/20070816T193609Z.html

https://www.economist.com/media/globalexecutive/fortunes_formula_e.pdf

https://towardsdatascience.com/python-risk-management-kelly-criterion-526e8fb6d6fd

Writing

ChatGPT at it’s finest: writing short helpful code

ChatGPT at it’s finest: writing short helpful code without having to do fancy work.

The following is a dialog with ChatGPT. I had this script that I would normally have to hand edit all of the ticker  symbols by adding them to the end of the lines of code. I am sure there is some clever way using sed or awk but, I figured why not get ChatGPT to help.

ChatGPT then was also able to generate the Tags for this post,by feeding the post into a prompt and I used Stable Diffusion to generate the featured image using the blog title as the prompt. Sometimes it is good to use ChatGPT to proofread as well but, this post was short and simple enough not to do that.


User

I want to show you an output, in the left column are the ticker symbols for a number of cryptocurrencies, I want you to remember all of them as they will be used in the next question that I will pose…..

Currency  Price      Available  Hold      Avail in USD  Held in USD
AAVE 98.16          0.0 0.0              0.0
ACH 0.020353          0.0 0.0              0.0
ADA 0.3859          0.0 0.0              0.0
ALGO 0.1341          0.0 0.0              0.0
AMP 0.00248          0.0 0.0              0.0
ANKR 0.0244          0.0 0.0              0.0
ATOM 9.283          0.0 0.0              0.0
AVAX 20.66          0.0 0.0              0.0
AXS 6.8          0.0 0.0              0.0
BAL 3.68          0.0 0.0              0.0
BAND 1.417          0.0 0.0              0.0
BAT 0.21159          0.0 0.0              0.0
BCH 223.72          0.0 0.0              0.0
BNT 0.75          0.0 0.0              0.0
BOND 2.2          0.0 0.0              0.0
BTC 37964.39          0.0 0.0              0.0
CGLD 0.53          0.0 0.0              0.0
COMP 51.17          0.0 0.0              0.0
CRV 0.5658          0.0 0.0              0.0
CVC 0.1102          0.0 0.0              0.0
DAI 0.9999          0.0 0.0              0.0
DOGE 0.08033          0.0 0.0              0.0
DOT 5.263          0.0 0.0              0.0
ETC 18.86          0.0 0.0              0.0
ETH 2054.84          0.0 0.0              0.0
FARM 32.73          0.0 0.0              0.0
FET 0.5347          0.0 0.0              0.0
FIL 4.545          0.0 0.0              0.0
GLM 0.2418          0.0 0.0              0.0
GRT 0.1483          0.0 0.0              0.0
ICP 4.605          0.0 0.0              0.0
KNC 0.7065          0.0 0.0              0.0
LINK 14.588          0.0 0.0              0.0
LOOM 0.0673          0.0 0.0              0.0
LPT 6.33          0.0 0.0              0.0
LRC 0.216          0.0 0.0              0.0
LTC 69.78          0.0 0.0              0.0
MANA 0.4405          0.0 0.0              0.0
MATIC 0.7528          0.0 0.0              0.0
MIR 0.0941          0.0 0.0              0.0
MKR 1483.6          0.0 0.0              0.0
MLN 15.12          0.0 0.0              0.0
NKN 0.1064          0.0 0.0              0.0
NMR 15.68          0.0 0.0              0.0
OGN 0.12922          0.0 0.0              0.0
OMG 1.7217          0.0 0.0              0.0
OXT 0.0724          0.0 0.0              0.0
PLA 0.204          0.0 0.0              0.0
POLY 0.1963          0.0 0.0              0.0
QNT 99.56          0.0 0.0              0.0
REN 0.0823          0.0 0.0              0.0
REQ 0.083          0.0 0.0              0.0
RLC 1.4794          0.0 0.0              0.0
RLY 0.0126          0.0 0.0              0.0
SKL 0.0436          0.0 0.0              0.0
SNX 3.392          0.0 0.0              0.0
SOL 58.2          0.0 0.0              0.0
STORJ 0.7658          0.0 0.0              0.0
UMA 1.953          0.0 0.0              0.0
UNI 6.161          0.0 0.0              0.0
USD              0.01 0.0
USDC              0.0 0.0
XLM 0.118572          0.0 0.0              0.0
XTZ 0.817          0.0 0.0              0.0
YFI 8519.94          0.0 0.0              0.0
ZEC 29.03          0.0 0.0              0.0
ZRX 0.39338          0.0 0.0              0.0

I don’t have the ability to remember information from one interaction to the next, but I can certainly help you analyze or work with the data you’ve provided in this session. If you have a specific question or task related to this cryptocurrency data, feel free to let me know, and I’ll do my best to assist you!

User

Can you print out all of the symbols in the left column?

Certainly! Here are all the ticker symbols from the left column:

objectivec
AAVE, ACH, ADA, ALGO, AMP, ANKR, ATOM, AVAX, AXS, BAL, BAND, BAT, BCH, BNT, BOND, BTC, CGLD, COMP, CRV, CVC, DAI, DOGE, DOT, ETC, ETH, FARM, FET, FIL, GLM, GRT, ICP, KNC, LINK, LOOM, LPT, LRC, LTC, MANA, MATIC, MIR, MKR, MLN, NKN, NMR, OGN, OMG, OXT, PLA, POLY, QNT, REN, REQ, RLC, RLY, SKL, SNX, SOL, STORJ, UMA, UNI, USD, USDC, XLM, XTZ, YFI, ZEC, ZRX

If you have any specific tasks or questions related to these symbols, feel free to let me know!

User

OK, good, you remembered them. Now for the next step. I am going to show an example using btc and I would like you to create a listing with all of the ticker symbols from the left column. Example: $DIR/rsi-fractals-avgs-bbands-txt-summary.py btc

Sure, I understand. If you could provide an example of the desired output or clarify the specific format or information you’re looking for related to each ticker symbol (similar to the example you provided with btc), I’d be happy to assist you further.

User

I am looking for you to create code that has $DIR/rsi-fractals-avgs-bbands-txt-summary.py on every line but with the ticker symbols from the left column appear on that line right after it.

Certainly! It sounds like you want a list of commands where $DIR/rsi-fractals-avgs-bbands-txt-summary.py is followed by each ticker symbol. Here’s an example Python script that generates those commands:

python
# List of ticker symbols ticker_symbols = [     "AAVE", "ACH", "ADA", "ALGO", "AMP", "ANKR", "ATOM", "AVAX", "AXS", "BAL",     "BAND", "BAT", "BCH", "BNT", "BOND", "BTC", "CGLD", "COMP", "CRV", "CVC",     "DAI", "DOGE", "DOT", "ETC", "ETH", "FARM", "FET", "FIL", "GLM", "GRT", "ICP",     "KNC", "LINK", "LOOM", "LPT", "LRC", "LTC", "MANA", "MATIC", "MIR", "MKR",     "MLN", "NKN", "NMR", "OGN", "OMG", "OXT", "PLA", "POLY", "QNT", "REN", "REQ",     "RLC", "RLY", "SKL", "SNX", "SOL", "STORJ", "UMA", "UNI", "USD", "USDC", "XLM",     "XTZ", "YFI", "ZEC", "ZRX" ] # Directory variable DIR = "$DIR" # Generate commands commands = [f"{DIR}/rsi-fractals-avgs-bbands-txt-summary.py {symbol}" for symbol in ticker_symbols] # Print commands for command in commands:     
       print(command)

Replace $DIR with the actual directory you want to use. This script will generate commands for each ticker symbol, following the format you provided. If you have any specific adjustments or requirements, feel free to let me know!


OK how did it turn out?

This is the output, just as I expected and was looking for. Saved me probably about 15 minutes of tedious hand editing…

$DIR/rsi-fractals-avgs-bbands-txt-summary.py AAVE
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ACH
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ADA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ALGO
$DIR/rsi-fractals-avgs-bbands-txt-summary.py AMP
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ANKR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ATOM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py AVAX
$DIR/rsi-fractals-avgs-bbands-txt-summary.py AXS
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BAL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BAND
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BAT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BCH
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BNT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BOND
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BTC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py CGLD
$DIR/rsi-fractals-avgs-bbands-txt-summary.py COMP
$DIR/rsi-fractals-avgs-bbands-txt-summary.py CRV
$DIR/rsi-fractals-avgs-bbands-txt-summary.py CVC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py DAI
$DIR/rsi-fractals-avgs-bbands-txt-summary.py DOGE
$DIR/rsi-fractals-avgs-bbands-txt-summary.py DOT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ETC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ETH
$DIR/rsi-fractals-avgs-bbands-txt-summary.py FARM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py FET
$DIR/rsi-fractals-avgs-bbands-txt-summary.py FIL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py GLM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py GRT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ICP
$DIR/rsi-fractals-avgs-bbands-txt-summary.py KNC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LINK
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LOOM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LPT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LRC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LTC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MANA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MATIC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MIR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MKR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MLN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py NKN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py NMR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py OGN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py OMG
$DIR/rsi-fractals-avgs-bbands-txt-summary.py OXT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py PLA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py POLY
$DIR/rsi-fractals-avgs-bbands-txt-summary.py QNT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py REN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py REQ
$DIR/rsi-fractals-avgs-bbands-txt-summary.py RLC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py RLY
$DIR/rsi-fractals-avgs-bbands-txt-summary.py SKL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py SNX
$DIR/rsi-fractals-avgs-bbands-txt-summary.py SOL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py STORJ
$DIR/rsi-fractals-avgs-bbands-txt-summary.py UMA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py UNI
$DIR/rsi-fractals-avgs-bbands-txt-summary.py USD
$DIR/rsi-fractals-avgs-bbands-txt-summary.py USDC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py XLM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py XTZ
$DIR/rsi-fractals-avgs-bbands-txt-summary.py YFI
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ZEC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ZRX

What’s it for?

It is screener code that will go into a script that prints out all the cryptos in the list sorted by their position relative to their 20 day moving average. It uses the same logic as used for the Mayer Multiple, except it is on a 20 day MA basis.

X = Current Price / 20DMA

Code

#!/bin/bash 
DIR="/home/erick/python/ta"


rm $DIR/output-rsi-er-price-sma20-multiple.csv

$DIR/rsi-fractals-avgs-bbands-txt-summary.py AAVE
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ACH
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ADA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ALGO
$DIR/rsi-fractals-avgs-bbands-txt-summary.py AMP
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ANKR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ATOM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py AVAX
$DIR/rsi-fractals-avgs-bbands-txt-summary.py AXS
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BAL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BAND
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BAT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BCH
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BNT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BOND
$DIR/rsi-fractals-avgs-bbands-txt-summary.py BTC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py CGLD
$DIR/rsi-fractals-avgs-bbands-txt-summary.py COMP
$DIR/rsi-fractals-avgs-bbands-txt-summary.py CRV
$DIR/rsi-fractals-avgs-bbands-txt-summary.py CVC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py DAI
$DIR/rsi-fractals-avgs-bbands-txt-summary.py DOGE
$DIR/rsi-fractals-avgs-bbands-txt-summary.py DOT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ETC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ETH
$DIR/rsi-fractals-avgs-bbands-txt-summary.py FARM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py FET
$DIR/rsi-fractals-avgs-bbands-txt-summary.py FIL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py GLM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py GRT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ICP
$DIR/rsi-fractals-avgs-bbands-txt-summary.py KNC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LINK
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LOOM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LPT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LRC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py LTC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MANA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MATIC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MIR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MKR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py MLN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py NKN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py NMR
$DIR/rsi-fractals-avgs-bbands-txt-summary.py OGN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py OMG
$DIR/rsi-fractals-avgs-bbands-txt-summary.py OXT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py PLA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py POLY
$DIR/rsi-fractals-avgs-bbands-txt-summary.py QNT
$DIR/rsi-fractals-avgs-bbands-txt-summary.py REN
$DIR/rsi-fractals-avgs-bbands-txt-summary.py REQ
$DIR/rsi-fractals-avgs-bbands-txt-summary.py RLC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py RLY
$DIR/rsi-fractals-avgs-bbands-txt-summary.py SKL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py SNX
$DIR/rsi-fractals-avgs-bbands-txt-summary.py SOL
$DIR/rsi-fractals-avgs-bbands-txt-summary.py STORJ
$DIR/rsi-fractals-avgs-bbands-txt-summary.py UMA
$DIR/rsi-fractals-avgs-bbands-txt-summary.py UNI
$DIR/rsi-fractals-avgs-bbands-txt-summary.py USD
$DIR/rsi-fractals-avgs-bbands-txt-summary.py USDC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py XLM
$DIR/rsi-fractals-avgs-bbands-txt-summary.py XTZ
$DIR/rsi-fractals-avgs-bbands-txt-summary.py YFI
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ZEC
$DIR/rsi-fractals-avgs-bbands-txt-summary.py ZRX


echo "Cur  ,Und,Targt,RSI, ER,20Ml,Mayer Mult."


# Sort by desending price/sma20 multiples
sort -nk6 -t, -r $DIR/output-rsi-er-price-sma20-multiple.csv

the script runs the rsi-fractals-avg-bbands-txt-summary code on all the tickers listed and saves output to…

output-rsi-er-price-sma20-multiple.csv

then sorts the output by the 20sma multiple column

 

Results

Best relative performers on top, worst on bottom. This idea comes from the book Fortune’s Formula and appears as a technique used by Princeton-Newport. Basically sell the top and buy the bottom ( deep value…maybe), or alternativly short the top and long the bottom. Or in the case of crypto the bottom ones might be just be duds that are always behind the pack, maybe don’t even bother with them.

Cur  ,Und,Targt,RSI, ER,20Ml,Mayer Mult.
UNI  ,USD,False,73,0.06,1.18,1.31
SKL  ,USD,False,63,0.07,1.1 ,1.59
FET  ,USD,False,67,0.14,1.09,1.97
SNX  ,USD,False,63,0.09,1.07,1.43
GRT  ,USD,False,60,0.05,1.07,1.37
AXS  ,USD,False,56,0.0 ,1.07,1.2
AMP  ,USD,False,63,0.05,1.06,1.17
MKR  ,USD,False,60,0.13,1.05,1.34
AVAX ,USD,False,61,0.07,1.05,1.61
RLC  ,USD,False,61,0.01,1.04,1.19
OGN  ,USD,False,56,0.05,1.03,1.33
UMA  ,USD,False,52,0.07,1.01,1.13
NMR  ,USD,False,55,0.02,1.01,1.14
MANA ,USD,False,48,0.01,1.01,1.18
DOGE ,USD,False,55,0.02,1.01,1.15
BTC  ,USD,False,54,0.14,1.01,1.27
REQ  ,USD,False,52,0.02,1.0 ,1.1
NKN  ,USD,False,59,0.02,1.0 ,1.1
ICP  ,USD,False,51,0.04,1.0 ,1.14
FARM ,USD,False,53,0.04,1.0 ,1.31
ETH  ,USD,False,47,0.04,1.0 ,1.13
DAI  ,USD,False,44,0.01,1.0 ,1.0
ATOM ,USD,False,49,0.05,1.0 ,1.09
ADA  ,USD,False,57,0.01,1.0 ,1.25
AAVE ,USD,False,52,0.08,1.0 ,1.38
STORJ,USD,False,46,0.13,0.99,2.0
SOL  ,USD,False,51,0.19,0.98,2.12
ALGO ,USD,False,47,0.06,0.98,1.13
ACH  ,USD,False,51,0.02,0.98,1.07
ZEC  ,USD,False,43,0.04,0.97,1.0
XLM  ,USD,False,43,0.05,0.97,1.03
LTC  ,USD,False,42,0.03,0.97,0.89
LINK ,USD,False,46,0.17,0.97,1.8
DOT  ,USD,False,45,0.01,0.97,1.08
COMP ,USD,False,49,0.05,0.97,1.11
QNT  ,USD,False,43,0.02,0.96,0.98
PLA  ,USD,False,45,0.02,0.96,1.19
OXT  ,USD,False,47,0.01,0.96,1.13
ETC  ,USD,False,39,0.0 ,0.96,1.07
CRV  ,USD,False,47,0.08,0.96,0.92
BCH  ,USD,False,36,0.1 ,0.96,1.08
LRC  ,USD,False,42,0.08,0.95,0.99
FIL  ,USD,False,41,0.0 ,0.95,1.14
CGLD ,USD,False,44,0.0 ,0.95,1.07
BAL  ,USD,False,38,0.12,0.95,0.88
XTZ  ,USD,False,38,0.03,0.94,1.03
MLN  ,USD,False,36,0.05,0.94,0.9
BAT  ,USD,False,38,0.01,0.94,1.07
BAND ,USD,False,44,0.01,0.94,1.12
ANKR ,USD,False,43,0.01,0.94,1.06
LPT  ,USD,False,41,0.04,0.92,1.13
GLM  ,USD,False,41,0.02,0.92,1.18
CVC  ,USD,False,48,0.05,0.91,1.27
ZRX  ,USD,False,36,0.09,0.9 ,1.68
YFI  ,USD,False,42,0.04,0.9 ,1.32
MATIC,USD,False,28,0.03,0.9 ,1.1
KNC  ,USD,False,27,0.03,0.9 ,1.11
BNT  ,USD,False,32,0.08,0.9 ,1.56
POLY ,USD,False,30,0.01,0.81,1.2

 

 

ChatGPT will create Tags

Finally by posting this post into a prompt you can ask ChatGPT to generate Tags for the post. I used most of them but trimmed a few that were redundant.

sellbuy-o-meter

We are governed by laws, not by laws, but by people. Government is by people.

We all need a sellbuy-o-meter

  • Get the timing just right every time.

  • No more missing the tops and bottoms.

  • Maximize profits right from the start.

  • Be a winner every time.

Hey there, it’s your favorite lawyer, Saul Goodman, and I’ve got some advice for all you traders out there. You need a sellbuy-o-meter, plain and simple. This little gadget tells you when to buy and sell, so you can get the timing just right every time. No more missing the tops and bottoms of the market, my friends. You’ll be maximizing your profits right from the start and be a winner every time.

With this sellbuy-o-meter, who needs stop losses? You’ll be making maximum gains with no losses. Your eyes will thank you, too, because there’ll be no more chart reading voodoo and magic. Put away your lucky charms and get ready to use some 10x or more leverage.

And let me tell you, you’ll sleep like a baby at night knowing you’ll never get a trade wrong. Risk management will only entail replacing the batteries in the meter. (Batteries not included, unfortunately.)

So what are you waiting for? Order your sellbuy-o-meter today and get a free spouse-o-meter! This little beauty tells you what mood your significant other is in – mad, sad, or glad – we’ve got them all covered. Don’t hesitate – order now!

sellbuy-o-meter
sellbuy-o-meter

Sometimes these Clickbait con-tra-prenur social media ads just get under my skin. It feels a little bit like I am being sold a scam by Slippin Jimmy a.k.a. Saul Goodman.

Daytrading: Response to Clickbait Ad

I responded to an clickbait ad on social media with the following.

Daytrading, I would not recommend it for newbies. It’s not for everyone and it’s not something to jump into blindly. With trading in general, start very small, like 1% of your net worth, learn and then build up your position sizes slowly as a reward for success. Other than your ‘play’ money, while learning just buy and hold with the bulk of you invest able $. Daytrading is something to do only when a level of mastery of trading on higher time frames using small money. Trading will cost you money and time until you gain experience, these are the facts, plain and simple. It is part skill, part art, timing and luck. The shorter the time frame, the higher the market noise relative to the signal that you are trying to capture and make trades on, this combined with fees and slippage makes daytrading difficult to begin with (Super quick trades, noise, fees and slippage will eat your $ up.). Is it possible to make money daytrading ,yes, but you will be strapped to a computer to do it, is that something that will be enjoyable in the long run, seriously think about it. Do you really want to sit in front of the computer watching 1,5,15m candles with a finger hovering on the mouse all day. That’s for machines to excel at, really, that’s how the big firms can even make money at all, besides low fees and getting paid for order flow. Being able to code algorithms to trade for you via an API, then you just have to babysit the system to make sure it is working right, less work than sitting in front of charts on PC all day, requires math,coding and fintech type skill however. That might be a path to daytrading for the committed in the long run. If none of the preceding jargon makes sense, time to study up. Knowledge of probabilities and statistics go a long way, I had to relearn quite a bit of this, yeah it sucked a bit, should have paid more attention in those classes. Understand what the Kelly Criterion is, “Fortune’s Formula” the book, covers it. That way you can get a grasp on risk management and don’t blow up your account. A so-so trader with good risk management will make money. A good trader with poor risk management will fail, the account will go up and down, maybe most and more down,boom and bust and potentially fully bust. Works by Ed Thorp, Elder Alexander, Perry Kaufmann, John Murphy are a good foundation to understand trading. Reminiscences of a Stock Operator Book by Edwin Lefèvre Zen, they hand this out at Goldman when you start there. Get to understand the Psychology of trading and money (Morgan Housel), the ups and downs are rough. If you don’t get a grasp on how it impacts you emotionally it will be painful in the gut. Position sizes, watch those, you want to be able to sleep at night, once again we are talking risk management. If you’ve studied the foundations and it still doesn’t make sense keep studying, it might keep sinking in while you practice trade with small money and put a chunk in buy+hold. As you gain experience some of the material you study will start to make more sense, time to reread. If after all this, it still doesn’t work, find a mentor who will help you, someone who has “made it” and is willing to give back to help the next generation. Ideally buddy up with someone from the start, find a club. There is too much hype and charlatanism out there waiting to mislead and take advantage of newbies, pushing a lot of nonsense.

Another Similar Response to an Ad on how to figure out Bull/Bear conditions

You can tell if it is bullish or bearish in a few minutes, why it is bullish or bearish, well that can take much longer to figure out. But, you can learn this yourself or find a mentor. Hang around the right people and you will learn, find a mentor who will help you, someone who has “made it” and is willing to give back to help the next generation. Ideally buddy up with someone from the start, find a club. There is too much hype and charlatanism out there waiting to mislead and take advantage of newbies, pushing a lot of nonsense………But for now, practical wise, an example of figuring out bull/bear bias of an asset. Ichimoku chart is good to use and learn, on it, is the Tenken above the Kijun? Is the price above both of those? Is the price above the cloud? Also is the asset in a golden cross 50 day MA > 200 day MA. Then look at the macro picture, over all market up? Is the sector up? These are Bull signals, the more the better. Better yet, figure out your own method and come up with a checklist. Also, price can always change on a whim, you can’t predict it. Use risk mgmt to mitigate against loss, tomorrow there could be a banking crisis, political crisis, war, flash crash, protect against those as well as you can.

Precious Metal Accumulation and Distribution

Precious Metal Exchanges

A few examples to get started with…

https://www.coinexchangeny.com
https://libertycoin.com/
https://www.jmbullion.com/

Resources

Silver Dragons

The Silver Dragons channel is about silver stacking, buying silver, silver investing, precious metals, gold investing and anything to do with silver or gold …
https://www.youtube.com/channel/UCucqfNRyBkieAop_LDUqHEg

Yankee Stacking

One New Englander trying to stack silver and gold the “Yankee Way”!Stack silver and gold to hedge against our debt-fueled, fiat currency-based economy that …
https://www.youtube.com/c/YankeeStacking

Tickers on Yahoo Finance, this is where the iPhone gets prices

SI=F Silver Futures next delivery period, close enough to the spot price.
GC=F Gold Futures next delivery period, close enough to the spot price.
DXY (DX-Y.NYB) Dollar Index, strength of the USD against a basket of other currencies, The six currencies included in the USDX are the Euro, Swiss franc, Japanese yen, Canadian dollar, British pound, and Swedish krona. When the dollar goes up, metals go down and vice versa.

Investing Basics

All of the basics of investing apply to not only gold and silver but in general, only this first idea is specific to gold and silver.

Do you buy gold, silver, both?

A general rule for investing that gives a short answer for Gold -v- Silver.

When the ratio of the Gold price divided by the Silver price is…
> 80 Buy Silver
60-80 Buy Both
< 60 Buy Gold
Some people will even pairs-trade (swap) between the two to accumulate more metal over time. As in when > 80 buy silver by selling gold. When < 60 buy gold by selling silver. 60-80 is a neutral zone do nothing.

DCA

The following applies to metals or any other long term investment.

You can’t always predict the right moment to move a large sum into or out of an investment.

For investing it is best to dollar cost average (DCA) in and out of a position. Buying and selling on a periodic basis helps accumulate and distribute at average reasonable prices over the long haul of time. This can be done weekly, monthly, quarterly. And it could be done by considering good prices to buy or sell at, with a buy lower and sell higher plan.

Buy Lower/Sell Higher

The following applies to metals or any other long term investment.

You can’t always pick the bottom or top of a market.

A simple rule is to buy when the price is lower than it has been in a while, buying a local low and the converse on highs. The concept can be used to improve upon the ‘blind’ DCA, buy on a regular periodic basis.
Looking back at the high or low from the past year, or market cycle works fine for picking a reasonable high and low point. Keep buying in small amounts when below a local low and selling small amounts when above ( preferably longer timeframe ) local high. It is not always worth trying to ‘time’ the tops and bottoms of the market as this is very tricky even for sophisticated traders.

Judging Value Simply

The following applies to metals or any other long term investment.

Is it a bargain or overpriced?

When starting out it in investing is hard to judge value, so a quick and easy to spot way is the best way to start to get thinking about value.

A reasonable rule is to use the midpoint between the last big high or low price and keep accumulating up to that midpoint. In this manner you can easily tell that you are buying ‘value’ and not buying the asset when it is overpriced. Then hold the asset until the appropriate market cycle which reaches beyond local highs, preferably higher than a previous high in the future and do the converse, slowly sell above the midpoint which should always be checked out to make sure it is in profitable range. It is easier to sell into a rising market as when the price hits a peak sometimes it can drop violently. Prices tend to fall faster than they rise.

Price Charts

How to view the price and a handy tool, the moving average of price.

Kitco among others has decent charts for metals that have moving averages on them as well. The moving averages are a tool that can help with trading and investing. They act as guides to see to position of the price relative to a slower,smoother version of the price, the average price. These charts can be used to help DCA in and out using the buy lower/sell higher, judging value simply or using the moving averages as described below to use a trading type strategy or to accumulate and distribute for long term investing.

Using charts as a  trading tool example

Moving averages can be used to follow a trend. When the price is above a moving average or even better, a short time average (like 14,30,60 days) is above a long average (200 days) there is an uptrend. It is possible to follow a trend by buying in when the short average crosses the long average and sell when the short average goes below the long average. This is an example of a ‘trade’, specifically a long trade or going long. Technically this is called a Dual Moving Average Crossover. This is just one simple example of many trading styles.

Using charts as a tool to accumulate and distribute example

Moving averages can be also used to accumulate and distribute by looking for lows that are worth DCA-ing in and out on. For example good buys would be in the zone where the following line up, ..

  • short moving average lower (try 30 or days- blue line on Kitco chart) than long moving average. 200 day, green line on Kitco chart), with price lower than both ( buy when 30 or 60 day average below 200, with price below both, blue line below green, with red price below both

This is like buying little nips at a time, buying mini-bottoms. The opposite can be done for distributing….

  •   ( sell when 30 or 60 day average above 200, with price above both, blue line above green, with red price above both ), unless you have a buy and hold forever plan.

https://www.kitco.com/charts/techcharts_gold.html

https://www.kitco.com/charts/techcharts_silver.html

BTC When Bottom

In December 2022, with BTC hovering in the 17K range after the FTX unwind , the question is when is the bottom coming ? Or in other words is BTC in a good range to stack or is more waiting required?

A few thoughts, like I thought about this for too long, hours. What got me going was all these predictions on the business news, 5K,10K,13.5K, whatnot. So a theory stood out based on looking back at history using the MVRV Z-Score and Puell Multiple from lookintobitcoin.com and the Mayer multiple from https://bitcoinition.com/charts/mayer-multiple/

Examine the 2022 low and the last low (Dec 2018 ) on the Puell and Mayer Multiples

Hunting for a low in the Puell and Mayer Multiple charts something interesting jumps out, they both point to a July 2022 time when BTC was around 20K. Looking back to December 2018 when they were both in the same kind of zone and at a bottom the BTC price at 3.2K was a definite good buy. BTC spent a lot of time at 6.5K in the Fall of 2018 and then dropped after the  November 15th, due to a FED rate hike. Confirming by looking at the MVRV Z- Score, the negative zones have seemed to coincide with the prices that are worth accumulating at. Now as of December 2022, all three seem to have all hit their low already and are climbing higher.

Hints at 20K and below

The fact that the Puell and Mayer hit a low in 2022, mid year and both print 20K BTC at least for me, gives a hint. Anything under 20K is pretty good, so hunt those local lows. (Like, buy at the bottom of the 20 day Bollinger Bands or even watch 200 Day Bollinger Bands for a dip around 1.5 SD below the midline. )Yes, the bottom could really go lower than the 15.5K. It certainly would have as the DXY (Dollar Index against a basket f currencies, such as Euro, Yen, CAD, Swiss Franc, Krona, GBP and I am sure I am forgetting one or two more) was pointing down pretty good by the time FTX hit the skids. If the DXY was significantly higher, a drop to 12-13K would not have been out of the question. Ironically, BTC looked like it was just about to move higher when the FTX meltdown crushed it down. It seems almost like some entity was hovering their finger over the push BTC down button waiting to release the FTX news, probably just a coincidence but a strange one though.

Here are the charts, judge for yourself, time will tell on this theory

Blockchain example slide

Proof of Work why use it and why does it use energy

Proof of Work

Proof of work relates to mining of cryptocurrency. It uses computing resources to solve a mathematical puzzle of sorts that takes a lot of compute power to solve but a minimum amount of power to verify that it has been completed. It is an example of a one way function. Easy to go one way but hard to go in the other. Imagine throwing a glass of water in the ocean, now imagine getting all of that water and only that water back out, like running a film backwards, might be impossible. The closer the one way function is to the glass in the ocean example the more secure a blockchain can be made. Why is that? Because it would take so much effort to mutate or corrupt the blockchain that it is not even worth trying.

Brilliant Idea, from Anti-SPAM to Blockchain

In the case of Bitcoin, mining occurs across thousands of nodes that can easily verify that the “work’ has been done and as long as there is a > 50% consensus among mining nodes , then the block is deemed valid and the nodes accept it and move on to the next block of transactions. So it would take an enormous amount of computing power to ‘fake’ a block and create a duplicate spend or a spend that pays an entity some unearned (Bitcoin) BTC, stealing it effectively. That in essence is the brilliance of Bitcoin and it’s pseudonymous creator Satoshi Nakamoto. All the ideas are not original, there was once an idea to use proof of work to prevent spam in email in the mid 1990s when SPAM became a nuisance. For regular uses it would delay the email by a few seconds, for a spammer sending out 1000’s of emails their computer would slow down to much to make it worth it. Satoshi Nakamoto took this idea and applied it to Bitcoin.

The chain part of block chain

On top of this, proof of work  that secures a single block, every block contains the hash of the previous block making it extremely hard to ‘fake’ out and create old blocks over as many hashes would have to be faked. So the longer the chain the more secure older transactions become as they become harder and harder to undo , or fake out.

Hashing in Cryptocurrency

Hashing is the key. Hashing is used in several ways in cryptocurrency.(toward the end of this post a second use is covered) . When mining a block a hash is generated for that block, a SHA256 hash. But not just any hash works. It has to be lower than a specific number determined by the difficulty adjustment, the so called target hash. This changes periodically to keep the outputs of blocks on the block chain, a giant electronic ledger of transactions, blocks are produced very 10 minutes on average. This also limits how many transactions can occur in a given time period. Blocks contain a finite number of transactions and they come out at period intervals, so there are only so many made per day. For Bitcoin this limits the daily transaction to something like around 300000. Other cryptocurrencies do better in this regard (but, buyer beware, they are beholden to companies or individuals that created them,so not independent from control like Bitcoin), so do layer 2 solutions like the Lightning network for Bitcoin. in the future most likely only large infrequent transactions will occur on Bitcoin main chain. With other solutions like the Lightning network or other cryptocurrencies serving to move money like PayPal or a Point Of Sale network, or Swift for that matter.

To create the special hash know as the target hash that meets the difficulty requirement means creating a hash that is lower than a specific 256 bit number. It contains a bunch of zeros at the beginning. This is done by add what is called a nonce ( just a random string will work, used just once  to make the hash come out lower than the target) to the block of transactions and computing the hash. The nonce can be a completely random string or a sequence of numbers tried in order, it really doesn’t matter. The only requirement is that whatever it is it creates a hash output that is lower than the number, target hash, specified by the difficulty requirement. In mining the first node that obtains this number will broadcast the result on the BTC network, all mining nodes will check it (hash the block and see if they agree, quick and easy to do), if it’s OK, the block becomes accepted added to the chain and that miner, the one who solved the hash, gets the block reward along with the fees for all the transactions that have been validated in the block. And, all nodes move on to the next block.

The hash itself

A typical block hash would look something like this…

00000000000000000007cd983a54a4eaf969d79961681fa2fa41eff0aba4a168

Notice all the zeros. With 256 byte number, using SHA256, it is hexadecimal where every number is 0-15 it takes a while to arrive at a number like this. Basically all the nodes that handle the blockchain that are mining are trying to get a ‘low’ number by changing the nonce.

Energy

This takes a lot of computing power and therefore energy. And, this is the complaint when it comes to cryptocurrency that are mined such as Bitcoin. The energy used to mine Bitcoin is equal to that of a small country. But, it has to be remembered that the whole financial technology sector of the economy still dwarfs the energy use of Bitcoin. Just imagine all of the ATMs alone that are plugged in all over the world, the computers running in the banks, heating, other electric and etc. Also, Bitcoin can be mined using energy that is otherwise orphaned. Meaning energy that can not be used for anything else. An example is natural gas and a petroleum well that might normally be flared off. Instead of flaring it off, it could be burned in a gas turbine turning a generator and run mining equipment. The mining equipment could be connected via Cell network or Satellite if no wire are available in a remote location. It is a way of burning a fuel at the source and generating value from it that otherwise would go to waste.

Proof of Work Example

Just a simple example of using a nonce along with a string ‘hello’ in this case and then printing out the resulting hashes of the new compound string of hello+nonce.

As more zeroes are required it gets harder and harder to find a nonce that will satisfy the requirement. To find the first hash with one zero at the start it takes 28 tries, ‘hello28’.

To get 8 leading zeroes it takes hello1202655595  = 1202655595 tries, on fairly regular computer it took from 2022-11-19 15:42 to 2022-11-19 16:48. Just over 1 hour.

Proof of Work Here it comes, ready…

I can give you the hash…

00000000e0d103722c6e172e145d15b9e909e109b47b30d741911bdb3cf3da84

and the string….

hello1202655595

….and this is proof that work was done. You can prove it. It took work to get this result, the computer ‘did’ something hard. It takes almost no energy and time to verify that the hash above is generated by hello1202655595, so it is cheap to verify but expensive to produce.

By ‘stamping’ this result into the blocks on the blockchain, hash of previous block into every block, it is very hard (glass of water back out the ocean hard) to create a forgery or do some other type of nastiness to the blockchain. Proof of Work secures the blockchain.

(Python code at the bottom of this post)

erick@OptiPlex-7010:~/python/hashing$ python3 multi-pow-hash-of-string.py 
Enter String to hash: hello
2cf24dba5fb0a30e26e83b2ac5b9e29e1b161e5c1fa7425e73043362938b9824
2022-11-19 15:42:15.173991 1 hello28 02a13c40ba00dc0fb199d3cbe5b01be59d937775890243fd411bdf001935ffc8
2022-11-19 15:42:15.175116 2 hello227 001b92541ed0a22b0cb89018b561d895503206c0082c0ecf2d0b7e5182191eed
2022-11-19 15:42:15.206154 3 hello10284 0006bc9ad4253c42e32b546dc17e5ea3fedaecdabef371b09906cea9387e8695
2022-11-19 15:42:15.350531 4 hello60067 0000e49eab06aa7a6b3aef7708991b91a7e01451fd67f520b832b89b18f4e7de
2022-11-19 15:42:15.771205 5 hello156056 0000037660ee0e22df67a053537e000325bbfad2cce9b8b7c795f6aa961d5cb7
2022-11-19 15:43:47.285252 6 hello33290382 000000865194de5c0744d72183dcce2eca2b69264b749a1798f1b6996baef7de
2022-11-19 15:49:22.363936 7 hello121001637 0000000bcd89bc714263460f7b1fc82562410b96eaeec5cc2175e83f2d215046
2022-11-19 16:48:46.136385 8 hello1202655595 00000000e0d103722c6e172e145d15b9e909e109b47b30d741911bdb3cf3da84

Keys and Addresses

To round it out, the other main use of cryptography in cryptocurrencies, the private key, secures your ‘coins’. If you aren’t careful to hide and not reveal your private key, you lose your coins. Your public key which is basically translated into an address for BTC (and others) it is a 160 byte number can be freely given out, posted online, in email, put it anywhere you wish. Why? Because all someone an ever do with the public key/address is send you some ‘coin’. So if they did, great. And, if it is a publicly transparent blockchain like Bitcoin and most others, privacy coins such as Zcash and Monero for example being the exception, you can trace the transactions. Just put a public address into the browser search bar and various tools will appear that allow you to trace transactions to an address. So the criminals that think cryptocurrency gives them some kind of magic cloaking mechanism for their transactions are getting it wrong. The cryptography in cryptocurrency has nothing to do with keeping a record of transactions securing hidden away, in fact the transactions are as transparent as they could possibly be.

 



Infographic showing #3 a blockchain and a block consisting of it’s sequence number, the hash of the previous block and the nonce, plus a record of transactions.

The miner of the block gets the reward plus all the fees for the transactions. In 2021 when this was made the block reward was 6.25BTC per block mined. This is cut in half approximately every 4 years, until it drops off  altogether around the year 2140. By then the fees will be the only thing sustaining the miners financially. The fact that there is only a finite amount of Bitcoin that can be mined, ever, 21 Million of them, keeps inflation of Bitcoin at bay. This is not the case for all coins, some cryptocurrencies can create more and more coins at will, so they are inflationary. Bitcoin is a fixed supply of which most of it has been mined already. So most of the stock is already created and the flow of more coins gets lower and lower with each block reward halving, every 4 years. This concept of stock to flow is important because it is a measure of scarcity. If something can be made easily like fiat currency the flow can be a large input to the stock in existence. This is what is going on in 2022 with economies all over the world that have printed massive amounts of fiat money during the Covid crisis, when the stock to flow is not a good ratio, inflation results. The opposite occurs with gold for example, it is hard to increase the amount of gold pulled from the earth, so the flow of new gold into the current world stock of gold is less than 2% per year, (I think that I remember the max was just 2.2% somewhere in the WW2 time frame) so in essence the market is never flooded with new gold, which would debase gold against other stores of value.

Blockchain example slide

 

 

Blockchain example slide

'''
https://www.pythoncentral.io/hashing-strings-with-python/
'''
import hashlib
from datetime import datetime

mystring = input('Enter String to hash: ')
# Assumes the default UTF-8
hash_object = hashlib.sha256(mystring.encode())
print(hash_object.hexdigest())

for DIF in range(1,32):
    for n in range(1,1000000000000):

            x = mystring + str(n)
            hash_object = hashlib.sha256(x.encode())
            d = hash_object.hexdigest()

            #print(x,d)
            tally = 0

            for z in range(0,DIF):
                    if d[z] == '0':
                            tally += 1

            if tally == DIF:
                break

    timestamp = str(datetime.now())

    print(timestamp,DIF,x,d)

Resources

https://seekingalpha.com/article/4452010-bitcoin-energy-usage-isnt-a-problem-heres-why

https://ingoldwetrust.report/the-stock-to-flow-ratio-as-the-most-significant-reason-for-golds-monetary-importance/?lang=en

JPEG image Metcalfe's Law BTC

Bitcoin Charting Resources for Long Term Investing

“Good investing is not necessarily about making good decisions. It’s about consistently not screwing up.” – Morgan Housel author of The Psychology of Money

Accumulation/Distribution Aids

2 year moving average investor tool

https://www.lookintobitcoin.com/charts/bitcoin-investor-tool/

Puell Multiple, an oscillator, accumulate at bottoms, distribute at tops

https://www.lookintobitcoin.com/charts/puell-multiple/

MVRV Z-Score, an oscillator, accumulate at bottoms, distribute at tops

https://www.lookintobitcoin.com/charts/mvrv-zscore/

Pi cycle top indicator, finds tops…it actually worked again in 2021

https://www.lookintobitcoin.com/charts/pi-cycle-top-indicator/

Market Sentiment, fear and greed index…

Fear mode = Might be a buying opportunity, people are scared and dumping BTC probably at a loss to them in full panic mode, macro indicators are crashing, full panic, bank run on exchanges, major crisis crypto or otherwise…

Greed Mode = Look out, euphoria is happening, price may drop soon as BTC is in the news and suckers buying in late in the game pushing the price parabolic, like the old saying, ” Bulls run up the stairs only to jump out the window.”…

https://www.lookintobitcoin.com/charts/bitcoin-fear-and-greed-index/

HODL wave 1 year. BTC sitting on chain for more than a year, shows if people are accumulating or distributing

https://www.lookintobitcoin.com/charts/1-year-hodl-wave/

Realized Price, might be a good indicator of fair value for BTC.  A gauge of relative under/overvalue….

https://www.lookintobitcoin.com/charts/realized-price/

Wallet Sizes, who is holding large amounts of BTC, good to track the ‘smart money’, are they accumulating or distributing?

Wallet > 1 BTC

https://www.lookintobitcoin.com/charts/wallets-greater-than-1-btc/

Wallet > 10 BTC

https://www.lookintobitcoin.com/charts/wallets-greater-than-10-btc/

Wallet > 100 BTC

https://www.lookintobitcoin.com/charts/wallets-greater-than-100-btc/

Wallet > 1000 BTC

https://www.lookintobitcoin.com/charts/wallets-greater-than-1000-btc/

Look into Bitcoin, has many more charts…

https://www.lookintobitcoin.com/charts/


Mayer Multiple

Basically accumulate until it hits 2.4, then hold, sell at the top optionally, then when it drops below 1.5 start accumulating again.

https://bitcoinition.com/charts/mayer-multiple/

Metcalfe’s Law Model

This is a static chart, (don’t remember where it is from) would love to see this as a dynamic one. Seems to show a fair value for BTC. Paper on Metcalfe’s law and Bitcoin