Introduction
Fintech is a popular buzzword. Why? Because it powers our money. Our banks, our assets, our investments all run through the tools that engineers have been building for years to make our monetary systems easy and powerful.
But what if I told you that fintech as you know it is in for a massive makeover?
That fintech has already started handing over market share to a new technology. That the skills needed to run a successful hedge fund, asset manager, data vendor, are going through the spin cycle of reform. Many of these pieces you see today, like python, devops, and algorithmic modeling will persist, but on a totally different platform.
We will go over what defi is, and how you can join.
If you know some #python, you'll want to stick around.
What is DeFi
Defi is proving to be the force that is going to be:
- More secure
- More transparent
- Faster
- Less corrupt
This year, we've seen an explosion from the defi scene, going from nearly nothing to nearly $15b in assets under management be decentralized protocols.
So what is defi?
Defi stands for "Decentralized Finance", and is a concept where non-custodial smart contracts hold your asset and automatically execute without a centralized intermediate. Meaning you don't have a banker who can freeze your assets anymore. You don't have an exchange where a trade takes 4 days to settle. You are finally truly in charge of your assets.
How is that possible?
Smart Contract platforms like Ethereum allow engineers to build applications that have no centralized authority and automatically execute. Everything is transparent on-chain and every can see the code. Imagine a commons that is tragedy resistant but instead of a plain or common, you have a computational system. This allows for people to truly own their asset.
More and more protocols are running in defi, and for good reason. The value add that blockchain/smart contract platforms have around transparency and security is huge, but the other massive thing is the current yield.
We are currently in a low-interest rate environment, where banks give next to nothing for holding your money. A defi protocol can do the same thing, and for nearly the same security net you 5% - 10% APY. In a traditional finance world, this is insane. Professional hedge funds don't make anywhere near that even on a short term basis.
Some of these platforms are doing revolutionary work. You can see the top projects at the moment on Defipulse, a platform that tracks defi project growth.
Aave is a decentralized borrowing and lending platforms, and has a tool called a "flash loan", which allows you to borrow as much as you want without any collateral. This is only possible with blockchain, but it allows you to be a whale for a very short period of time.
Synthetix is a decentralized protocol that allows for tokenizing assets into synthetic tokens. Meaning you can have your TSLA shares be a cryptocurrency and be traded with ease.
I've written a lot about Synthetix because the current stock market and securities buying world is fraught with corruption. The faster we can get these protocols to scale the better. If you want to read more about the power Synthetix will have, check this article out.
yearn.finance is the best-decentralized algotrader out there. It finds the highest APY of the various protocols and moves everyone's money to them in a way that maximized yield. In the traditional fintech world, this is a bigger issue than insider trading. A hedge fund not practicing best execution is a way bigger threat than insider trading.
Set Protocol build your own defi strategies and become an asset manager through just your public strategy on-chain. Anyone can set up a strategy.
How you can get involved
I ended above with two projects that current fintech engineers love. Yearn.finance and Set Protocol. Both are the current best iterations of decentralized algoritmic trading.
Imagine wanting to start a hedge fund with an amazing strategy but not having the capital to pay for a fancy lawyer to get all the paperwork started. You can get started without any of that with a strategy on one of these platforms. I love python, as does a lot of the algorithmic trading world and yearn.finance is a project run by ex-traditional fintech engineers, and they brought python with them.
This will be your guide to get a boilerplate strategy going.
Getting started with Python
Install the following:
pip install brownie
- ganache
npm install -g ganache-cli
Sign up for Infura and generate an API key. Store it in the WEB3_INFURA_PROJECT_ID
environment variable.
export WEB3_INFURA_PROJECT_ID=YourProjectID
Sign up for Etherscan and generate an API key. This is required for fetching source codes of the mainnet contracts we will be interacting with. Store the API key in the ETHERSCAN_TOKEN
environment variable.
export ETHERSCAN_TOKEN=YourApiToken
Then download the mix:
brownie bake yearn-strategy
Working with contracts
- Open the Brownie console. This automatically launches Ganache on a forked mainnet. Ganache is a fake blockchain that will run locally on your computer. This will simulate working with the real Ethereum network.
brownie console
- Create variables for the Yearn Vault and Want Token addresses. These were obtained from the Yearn Registry. Also, loan the Yearn governance multisig.
>>> vault = Vault.at("0xBFa4D8AA6d8a379aBFe7793399D3DdaCC5bBECBB") # yvDAI (v0.2.2)
>>> token = Token.at("0x6b175474e89094c44da98b954eedeac495271d0f") # DAI
>>> gov = "ychad.eth" # ENS for Yearn Governance Multisig
- Deploy the
Strategy.sol
contract.
>>> strategy = Strategy.deploy(vault, {"from": accounts[0]})
Transaction sent: 0xc8a35b3ecbbed196a344ed6b5c7ee6f50faf9b7eee836044d1c7ffe10093ef45
Gas price: 0.0 gwei Gas limit: 6721975
Flashloan.constructor confirmed - Block: 9995378 Gas used: 796934 (11.86%)
Flashloan deployed at: 0x3194cBDC3dbcd3E11a07892e7bA5c3394048Cc87
This will be your first transaction on-chain, nice work!
- Approve the strategy for the Vault. We must do this because we only approved Strategies can pull funding from the Vault.
# 1000 DAI debt limit, no rate limit, 50 bps strategist fee
>>> vault.addStrategy(strategy, Wei("1000 ether"), 2 ** 256 - 1, 50, {"from": gov})
Transaction sent: 0xa70b90eb9a9899e8f6e709c53a436976315b4279c4b6797d0a293e169f94d5b4
Gas price: 0.0 gwei Gas limit: 6721975
Transaction confirmed - Block: 9995379 Gas used: 21055 (0.31%)
- Now we are ready to put our strategy into action!
>>> harvest_tx = strategy.harvest({"from": accounts[0]}) # perform as many time as desired...
Strategy.sol
is where you can implement your own strategy and get started working with decentralized "algotrading".
Be sure to check out the repo to learn more about how it works, the community around it. Once you build something awesome, be sure to make some noise! The community love meeting new people.
Top comments (0)