Trading is the killer application of Web3. Citade-Sashimi enables the development of professional quant finance trading strategies for Sushi using Python scripting and Enzyme vaults.

Trading is the killer application of Web3.
This is the Github repository for Citade-Sashimi EthDubai hackathon project. The project implements non-custodial investable automated trading strategies on the top of Sushi DEX.
The hackathon comes with one example trading strategy, but it's easy to customise the approach for multiple professional-grade quant finance strategies. The strategies can be written in high-elvel Python, using on-chain data sources and 150+ technical indicators out of the box. No Solidity or low level blockchain knowledge is needed.
Watch the three minutes YouTube presentation:
Goal
Citade-Sashimi benefits decentralised finance users and Sushi
- For DeFi users the project offers professional grade investable trading strategies with features like portfolio rebalancing, stop loss
- For cryptocurrency traders non-custodial DeFi is safer than hack prone
- For Sushi and its liquidity providers the project offers high quality market taker volume.
- For strategy developers there is high-level, easy to use, and much more powerful tooling what mere Solidity smart contracts can do. There is also opportunity for profit-sharing as Enzyme Vaults offer on-chain fund management features.
Deliverables
In this hackathon we created
- Sushi adapter smart contract for Enzyme Vaults, so that trading strategies can perform rebalances using Sushi liquidity (see source, see Polygon smart contract)
- Trading Strategy backtesting and strategy development notebook for [creating trading algorithmic on the top of Sushi trading pairs and market data feeds].
- Demo website cidate-sashimi.com which allows you to connect the wallet and invest the Enzyme Finance vault smart contract that is controlled by Trading Strategy oracles
How does it work
- The trading strategy source code was developed by the hackathon team
- The trading strategy oracles run the the strategy source code offchain
- Oracles send trade instructions to the Enzyme vault smart contract using Sushi adapter
- The vault trades on Sushi DEX
- Users can invest and withdraw to the vault
- The vault automatically calculates profit sharing, shares, etc.

Example trading algorithm
We created an example trading strategy based on portfolio construction methodology.
We performed a backtest
- The strategy performance and cash reserves are denonimated in USDC
- Only long positions, spot market
- Trade on Sushi DEX, Polygon only
- Momentum trading
- Rebalance every 4 days
- Choose top three assets based on alpha signals
- Risk management:
- Strategy performance
- An example strategy. Currently the hackathon entry misses some performance calculation elements
The strategy performance vs. buy-and-hold MATIC, BTC and ETH. You can see the equity curve is more beautiful due to tighter risk management

Statistics about the example strategy performance and the risk of individual trades taken:

See the full strategy notebook backtesting results on Github for more statistics, or run the backtest yourself using the instructions below.
Note Because the strategy performs rebalance trades ~once per week, we cannot show any live trading results within the EthDubai hackathon period. We did some initial smoke testing trades using Python scripting to show that the live portfolio rebalance works against Sushi liquidity.
Architecture

- Polygon blockchain for the underlying chain
- Sushi DEX for the trading venue
- Enzyme Finance vaults smart contracts for managing strategy portfolio, investor shares and profit sharing
- Trading Strategy oracle for market data feeds, strategy development and backtesting
- Foundry for smart contract development
- SvelteKit frontend for the website
Development
For building the project you need
- Foundry
- Python
- Poetry
Include them:
git submodule update --init --recursive
Contracts
We have one in-house adapter contract and then a complex suite of contracts from other protocols.
- Contract compilation and deployment is managed by Forge
- Depends on Enzyme and OpenZeppelin
- Enzyme protocol is used for the investment vault
- Enzyme protocol is already deployed on Polygon
- We deploy a special Enzyme vault that is using custom SushiAdapter for connecting
- Enzyme protocol is already deployed on Polygon, so we do not deploy it
- The Trading Strategy oracle is set up as a fund manager for the vault

To compile:
cd forge
forge build
The vault is deployed and configured using hackathon/deploy.py
- Currently there is only one inhouse smart contract that is Enzyme-Sushi-Trading Strategy adapter
- We depend on web3-ethereum-defi package that contains 600+ precompiled Defi smart contracts
- We deploy Enzyme vault using our deployment script, ABI files from
web3-ethereum-defi
# Set up secrets for commands used in this README
source env/local.env
0x92fcde09790671cf085864182b9670c77da0884b is Enzyme IntegrationManager on Polygon
https://docs.enzyme.finance/developers/contracts/polygon
forge create \
--constructor-args 0x92fcde09790671cf085864182b9670c77da0884b \
--rpc-url $JSONRPCPOLYGON \
--private-key $PRIVATE_KEY \
--etherscan-api-key $ETHERSCANAPIKEY \
--verify \
src/SushiAdapter.sol:SushiAdapter
If/when PolygonScan contract verify fails please try again:
Deployer: 0x454E9F5219CD92BCAa8c5C0406c16fdA6116b342 Deployment address: 0x8b326FC39d222a7f8A6a210FBe3CDCDb2C2b62Ed
forge verify-contract \
--chain-id 137 \
--watch \
--constructor-args $(cast abi-encode "constructor(address)" "0x92fcde09790671cf085864182b9670c77da0884b") \
--compiler-version 0.6.12+commit.27d51765 \
--etherscan-api-key $ETHERSCANAPIKEY \
0x8b326FC39d222a7f8A6a210FBe3CDCDb2C2b62Ed \
src/SushiAdapter.sol:SushiAdapter
Strategy code
Strategy code is available as Python module that is read by Trading Strategy oracles.
To install`shell poetry install `
To open the backtesting Jupyter notebook for the strategy development locally:
poetry shell
jupyter lab notebook
Demo website and UX
The automated trading strategies offer the same simplified user experience as yield farming. The end user of DeFi needs only three buttons: Connect wallet, invest, withdraw.

- View the demo website www.citade-sashimi.com
- Frontend is written in SvelteKit.
Oracle
- Oracle is the server-side process the market feeds and drives strategy
- Run trade-executor Python package to run the oracle
- Oracle is deployed manually using Docker
- Oracle trades once in a week so unfortunately we could not demostrate any live trading in hackathon
- Deployment instructions are in the trade-executor documentation
- Multiple oracles can be deployed and configured to voting to make oracle
