GithubHelp home page GithubHelp logo

cowfeeder's Introduction

Cow Feeder

Cow Feeder is a bot automatically execute trade on cowswap, includes functions:

  • Monitoring Ethereum network gas price and execute trade when gas price is low and reaches target gas price set by user.
  • Protect trade from quick price change when bot waits for a good gas price.
  • Automatically approve to trade on cowswap when gas price is low and reaches target gas price set by user. (In progress)

Extra bonus to use Cow Feeder:

  • More chances to have CoWs. People are more likely to set same target gas price, such as 40 gwei, thus executing trade at a small time window together.

Requirements

Python 3

Setup

1. Install dependencies

pip install -r requirements.txt

2. Set config.json file

{
  "network": "mainnet",
  "http_provider_url": "https://mainnet.infura.io/v3/<api-key>",
  "your_wallet_address": "0x..........",
  "private_key": "your_wallet_address_private_key",
  "sell_token_address": "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
  "buy_token_address": "0x4ecaba5870353805a9f068101a40e0f32ed605c6",
  "sell_token_amount": "100",
  "least_buy_token_amount": "80",
  "target_gas_price": "40"
}

Http Provider Url

http_provider_url: If you don't already have a http provider, you can register a free one at infura.io.

Private Key

private_key: Private key is not mnemonic. With metamask, you can find it by clicking three dots, opening account detail and exporting private key. Private key is important. You can also leave private_key as an empty string in config.json and set it as environment variable with export private_key=your_wallet_private_key. Cow Feeder handles both cases.

Least buy token amount

least_buy_token_amount: While gas price goes down, price of trading pair might change as well. If the amount of token you are getting is lower than least buy token amount, Cow Feeder will not execute trade.

Gas Price

target_gas_price: Gas price is in gwei, you can decide target gas price by referring historical gas price at etherscan.io/gastracker.

3. Try it on xDai network

{
  "network": "xDai",
  "http_provider_url": "https://rpc.xdaichain.com/",
  "your_wallet_address": "0x..........",
  "private_key": "your_wallet_address_private_key",
  "sell_token_address": "0xddafbb505ad214d7b80b1f830fccc89b60fb7a83",
  "buy_token_address": "0x4ecaba5870353805a9f068101a40e0f32ed605c6",
  "sell_token_amount": "0.5",
  "least_buy_token_amount": "0.49",
  "target_gas_price": "1"
}

You can try it out on xDai network. You don't need a http provider api key for xDai network. Gas price on xDai network is usually at 1, you can refer to xdai gas price oracle

4. Run it

python cowfeeder.py

Contributors

Disclaimer

This is alpha release. Use at your own risk.

cowfeeder's People

Contributors

yellowcurtain avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.