Optimizing Your Pokemon Card Purchases with Pokebay
Are you a Pokemon card collector looking for the best deals on eBay? Do you want to minimize your total cost, including shipping, when buying multiple cards? Look no further! Introducing Pokebay, an application that uses Integer Linear Programming (ILP) to find the cheapest Pokemon single-card listings on eBay.
What is Pokebay?
Pokebay is a Node.js application designed to help Pokemon card collectors find the best deals on eBay. It fetches card data from the Pokemon TCG API and single-card listings from eBay. Using ILP, it optimizes the combination of listings to minimize the total cost, including shipping. The optimal solution is then exported to a CSV file for easy reference.
Key Features
- Fetches Card Data: Retrieves card information from the Pokemon TCG API.
- Fetches eBay Listings: Searches for single-card listings on eBay.
- ILP Optimization: Uses Integer Linear Programming to find the optimal combination of listings to minimize total cost.
- CSV Export: Exports the optimal solution to a CSV file for easy reference.
How It Works
1. Fetching Card Data
Pokebay starts by fetching card data from the Pokemon TCG API. You can specify the sets and card numbers you are interested in. The application retrieves detailed information about each card, including its name, set name, and card number.
2. Fetching eBay Listings
Next, Pokebay searches for single-card listings on eBay. It builds search queries based on the card data and fetches listings that match the criteria. The application caches the results to avoid redundant API calls and improve performance.
3. ILP Optimization
The core of Pokebay is its ILP optimization algorithm. It builds an ILP model that considers the prices and shipping costs of the listings. The goal is to minimize the total cost while ensuring that exactly one listing is chosen for each card. The ILP solver finds the optimal solution, which includes the chosen listings and their total cost.
4. Exporting to CSV
Finally, Pokebay exports the optimal solution to a CSV file. The file includes details about the chosen listings, such as the card name, seller, price, shipping cost, and URL. The CSV file is saved in the output
directory for easy access.
Getting Started
Prerequisites
- Node.js (v14 or higher)
- npm (v6 or higher)
Installation
-
Clone the repository:
git clone https://github.com/adamistheanswer/pokebay.git cd pokebay
-
Install the dependencies:
npm install
-
Create a
.env
file in the root directory and add your API keys:EBAY_BEARER_TOKEN=your_ebay_developer_bearer_token POKEMON_TCG_API_KEY=your_pokemon_tcg_api_key
Usage
-
Run the application:
npm run start
-
The application will fetch card data and listings, solve the ILP model, and export the optimal solution to a CSV file in the
output
directory.
TLDR
Pokebay is a powerful tool for Pokemon card collectors looking to optimize their purchases on eBay. By leveraging ILP, it ensures that you get the best deals while minimizing your total cost, including shipping. Give it a try and take your Pokemon card collection to the next level!
Happy collecting!