pek_pimp.py - Liquidity

I've really been putting in a lot of work to make these bots smarter and make trades...

The best way to make a coin liquid is have backing. The purpose of this is to bring liquid to the PIMP token.

I'm short with words because I am exhausted and have just gotten out of class.


def scan_liquid_markets():
    """
    Scan configured liquid markets for profitable trading opportunities.
    Returns list of opportunities: [(token, buy_price, sell_price, spread_pct, liquidity)]
    """
    opportunities = []
    
    for token in LIQUID_PAIRS:
        try:
            market = get_orderbook_top(token)
            if not market:
                continue
            
            bid = market.get("highestBid", 0)
            ask = market.get("lowestAsk", 0)
            
            if bid <= 0 or ask <= 0:
                continue
            
            # Calculate spread and liquidity
            spread_pct = get_spread_percent(bid, ask)
            buy_prices, sell_prices = get_orderbook_depth(token, depth=50)
            liquidity = compute_liquidity_score(buy_prices, sell_prices)
            
            # Only consider if liquidity is adequate and spread is profitable
            if liquidity >= MIN_MARKET_LIQUIDITY and spread_pct >= MULTI_MARKET_PROFIT_TARGET:
                profit_potential = spread_pct - MULTI_MARKET_PROFIT_TARGET  # Net profit after fees
                opportunities.append({
                    'token': token,
                    'bid': bid,
                    'ask': ask,
                    'spread_pct': spread_pct,
                    'liquidity': liquidity,
                    'profit_potential': profit_potential
                })
                
        except Exception as e:
            print(f"[MULTI-MARKET] Error scanning {token}: {e}")
            continue
    
    # Sort by profit potential
    opportunities.sort(key=lambda x: x['profit_potential'], reverse=True)
    return opportunities

def execute_cross_market_trade(account_name, opportunity, hive_available):
    """
    Execute a buy-sell cycle on a liquid market to accumulate HIVE.
    Returns HIVE profit earned (or 0 if failed).
    """
    global cross_market_profit, cross_market_trades
    
    token = opportunity['token']
    bid = opportunity['bid']
    ask = opportunity['ask']
    
    try:
        # Calculate trade size (conservative - use small portion)
        max_spend = min(hive_available * 0.15, MAX_HIVE_PER_CROSS_TRADE)  # Use 15% or max limit
        buy_price = ask  # Buy at ask for immediate fill
        qty = round(max_spend / buy_price, 8)
        
        if qty <= 0:
            return 0
        
        # Calculate expected sell proceeds
        sell_price = bid  # Sell at bid for immediate fill
        expected_hive = qty * sell_price
        expected_profit = expected_hive - max_spend
        profit_pct = (expected_profit / max_spend) * 100
        
        # Verify profitability
        if expected_profit <= 0 or profit_pct < MULTI_MARKET_PROFIT_TARGET * 100:
            print(f"[MULTI-MARKET] {token} not profitable enough: {profit_pct:.3f}%")
            return 0
        
        print(f"[MULTI-MARKET] 🎯 Trading {token}: Buy {qty:.4f} @ {buy_price:.8f}, Sell @ {sell_price:.8f}")
        print(f"[MULTI-MARKET] Expected: {max_spend:.4f} HIVE → {expected_hive:.4f} HIVE (+{expected_profit:.4f} = {profit_pct:.3f}%)")
        
        # Execute BUY
        buy_success = place_order(account_name, token, buy_price, qty, order_type="buy", 
                                  active_key=HIVE_ACTIVE_KEY, nodes=HIVE_NODES)
        if not buy_success:
            return 0
        
        time.sleep(4)  # Wait for order to process
        
        # Execute SELL (assume we got filled on buy)
        sell_success = place_order(account_name, token, sell_price, qty, order_type="sell",
                                   active_key=HIVE_ACTIVE_KEY, nodes=HIVE_NODES)
        
        if sell_success:
            cross_market_profit += expected_profit
            cross_market_trades += 1
            print(f"[MULTI-MARKET] ✅ {token} cycle complete! +{expected_profit:.4f} HIVE (Total from other markets: {cross_market_profit:.4f})")
            return expected_profit
        
        return 0
        
    except Exception as e:
        print(f"[MULTI-MARKET] Error executing {token} trade: {e}")
        return 0



🪙 PeakeCoin Ecosystem

💱 PeakeCoin USDT Bridge (Hive ↔ Polygon/MATIC)
Bridge SWAP.USDT from Hive Engine to USDT on Polygon (MATIC).
Whitelist access, documentation, and bridge status updates:
👉 https://geocities.ws/peakecoin


⚙️ HiveP.I.M.P. — PeakeCoin Intelligent Market Protector
Operated by @hivepimp, P.I.M.P. stabilizes PEK markets and supports liquidity on Hive Engine.
Community liquidity participation strengthens long-term market health.
📈 Open-source code, bots, and documentation:
👉 https://github.com/paulmoon410


🎰 PeakeSino — The PeakeCoin Casino (Beta)
Blockchain-powered games using PEK as the native in-game currency.
Built on Hive with a focus on provable fairness and community-driven growth.
🃏 Play the beta games here:
👉 https://geocities.ws/peakecoin/pek_casino/beta_games/index.html


🙏 Acknowledgements

Thanks to and please follow:
@enginewitty @ecoinstant @neoxian @txracer @thecrazygm @holdonia @aggroed

For their continued support, guidance, and help expanding the PeakeCoin ecosystem.




0
0
0.000
0 comments