Skip to content

Sellerlogic Service

Purpose

The Sellerlogic Service is dedicated to Amazon marketplace management. It integrates with Sellerlogic (a third-party repricer) and ProfitPath to automate pricing strategies and ensure profitability across different Amazon regions.

High-Level Architecture

The service runs as a Docker container (service-sellerlogic) exposing an API on port 8006.

  • Integrations:
  • Amazon SP-API: For fetching Buy Box prices and order data.
  • Sellerlogic API: For pushing min/max price boundaries.
  • ProfitPath: For advanced profitability calculations.
  • Frankfurter API: For real-time currency exchange rates (EUR/GBP/USD).
  • Data Flow:
  • Fetch: Get current Buy Box price from Amazon.
  • Calculate: Determine optimal price based on margin rules and exchange rates.
  • Push: Update Sellerlogic with new boundaries.

Database Schema

AmazonCredentials (amazon_credentials)

Stores OAuth tokens for the Amazon Selling Partner API (SP-API).

  • Key Fields: client_id, client_secret, refresh_token, token.
  • Auth: Handles the "Login with Amazon" (LWA) flow.

SellerlogicCredentials (sellerlogic_credentials)

Stores API keys for the Sellerlogic platform.

  • Key Fields: client_id, client_secret.

ProfitPathCredentials (profitpath_credentials)

Stores credentials for the ProfitPath tool.

  • Key Fields: email, password, api_key.

Application Structure

  • app.py: Entry point.
  • routers/:
  • sellerlogic_router.py: Core logic for repricing workflows.
  • amazon_router.py: Direct interaction with Amazon SP-API.
  • profitpath_router.py: Managing profit targets.
  • services/:
  • amazon_pricing.py: Logic for calculating break-even and target prices.

Key Workflows

1. Repricing Workflow

This process ensures that the prices sent to Sellerlogic are profitable.

graph TD Cron[Cron Job] -->|Trigger| Workflow[Pricing Workflow] Workflow -->|Get Exchange Rate| FX[Frankfurter API] Workflow -->|Get Buy Box| Amazon[Amazon SP-API] Workflow -->|Calculate Min/Max| Logic[Pricing Engine] Logic -->|Apply Margin Rules| Rules[Margin Rules] Logic -->|Push Boundaries| SL[Sellerlogic API]

2. Exchange Rate Sync

Since Amazon operates in multiple currencies (GBP, USD, EUR), the service fetches live rates from api.frankfurter.dev to convert costs accurately before calculating margins.

Technical Details

Amazon SP-API Integration

The service uses a custom client to interact with Amazon's complex SP-API.

  • Throttling: Implements exponential backoff to handle Amazon's strict rate limits.
  • Auth: Automatically refreshes LWA tokens using the refresh_token.

WebSocket Notifications

The service maintains a WebSocket connection to the frontend to stream real-time updates about repricing progress, as these jobs can take several minutes to complete for large inventories.