Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add pinkpunk #7069

Merged
merged 10 commits into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -555,4 +555,26 @@ models:
- inner_instruction_index
- check_bot_trades_seed:
seed_file: ref('jupbot_solana_trades_seed')
blockchain: solana

- name: pinkpunk_solana_bot_trades
meta:
blockchain: solana
sector: dex
project: pinkpunk
contributors: whale_hunter
config:
tags: ["solana", "dex", "pinkpunk", "trades"]
description: >
Pinkpunk trades on Solana
data_tests:
- dbt_utils.unique_combination_of_columns:
combination_of_columns:
- blockchain
- tx_id
- tx_index
- outer_instruction_index
- inner_instruction_index
- check_bot_trades_seed:
seed_file: ref('pinkpunk_solana_trades_seed')
blockchain: solana
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
, ref('tirador_solana_bot_trades')
, ref('mev_x_solana_bot_trades')
, ref('alpha_dex_solana_bot_trades')
, ref('pinkpunk_solana_bot_trades')
] %}

{% for bot in solana_trading_bot %}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
{{ config(
alias = 'bot_trades',
schema = 'pinkpunk_solana',
partition_by = ['block_month'],
materialized = 'incremental',
file_format = 'delta',
incremental_strategy = 'merge',
incremental_predicates = [incremental_predicate('DBT_INTERNAL_DEST.block_time')],
unique_key = ['blockchain', 'tx_id', 'tx_index', 'outer_instruction_index', 'inner_instruction_index']
)
}}

{% set project_start_date = '2024-06-13' %}
{% set fee_receiver_1 = '38e4GH49TwjXn2yARvnHueAKvU2xREtuchQahMiz3w9G' %}
{% set fee_receiver_2 = 'DShXwLqk6ZHZFtdzE8HMDsGJLhEvrxgRdB5K16V28arK' %}
{% set wsol_token = 'So11111111111111111111111111111111111111112' %}

WITH
allFeePayments AS (
jeff-dude marked this conversation as resolved.
Show resolved Hide resolved
SELECT
tx_id,
'SOL' AS feeTokenType,
balance_change / 1e9 AS fee_token_amount,
'{{wsol_token}}' AS fee_token_mint_address
FROM
{{ source('solana','account_activity') }}
WHERE
{% if is_incremental() %}
{{ incremental_predicate('block_time') }}
{% else %}
block_time >= TIMESTAMP '{{project_start_date}}'
{% endif %}
AND tx_success
AND balance_change > 0
AND (
address = '{{fee_receiver_1}}'
OR address = '{{fee_receiver_2}}'
)
),
botTrades AS (
SELECT
trades.block_time,
CAST(date_trunc('day', trades.block_time) AS date) AS block_date,
CAST(date_trunc('month', trades.block_time) AS date) AS block_month,
'solana' AS blockchain,
amount_usd,
IF(
token_sold_mint_address = '{{wsol_token}}',
'Buy',
'Sell'
) AS type,
token_bought_amount,
token_bought_symbol,
token_bought_mint_address AS token_bought_address,
token_sold_amount,
token_sold_symbol,
token_sold_mint_address AS token_sold_address,
fee_token_amount * price AS fee_usd,
fee_token_amount,
IF(feeTokenType = 'SOL', 'SOL', symbol) AS fee_token_symbol,
fee_token_mint_address AS fee_token_address,
project,
version,
token_pair,
project_program_id AS project_contract_address,
trader_id AS user,
trades.tx_id,
tx_index,
outer_instruction_index,
inner_instruction_index
FROM
{{ ref('dex_solana_trades') }} AS trades
JOIN allFeePayments AS feePayments ON trades.tx_id = feePayments.tx_id
LEFT JOIN {{ source('prices', 'usd') }} AS feeTokenPrices ON (
feeTokenPrices.blockchain = 'solana'
AND fee_token_mint_address = toBase58 (feeTokenPrices.contract_address)
AND date_trunc('minute', block_time) = minute
{% if is_incremental() %}
AND {{ incremental_predicate('minute') }}
{% else %}
AND minute >= TIMESTAMP '{{project_start_date}}'
{% endif %}
)
JOIN {{ source('solana','transactions') }} AS transactions ON (
trades.tx_id = id
{% if is_incremental() %}
AND {{ incremental_predicate('transactions.block_time') }}
{% else %}
AND transactions.block_time >= TIMESTAMP '{{project_start_date}}'
{% endif %}
)
WHERE
trades.trader_id != '{{fee_receiver_1}}' -- Exclude trades signed by FeeWallet
AND trades.trader_id != '{{fee_receiver_2}}' -- Exclude trades signed by FeeWallet
AND transactions.signer != '{{fee_receiver_1}}' -- Exclude trades signed by FeeWallet
AND transactions.signer != '{{fee_receiver_2}}' -- Exclude trades signed by FeeWallet
{% if is_incremental() %}
AND {{ incremental_predicate('trades.block_time') }}
{% else %}
AND trades.block_time >= TIMESTAMP '{{project_start_date}}'
{% endif %}
),
highestInnerInstructionIndexForEachTrade AS (
SELECT
tx_id,
outer_instruction_index,
MAX(inner_instruction_index) AS highestInnerInstructionIndex
FROM
botTrades
GROUP BY
tx_id,
outer_instruction_index
)
SELECT
block_time,
block_date,
block_month,
'Pinkpunk' as bot,
blockchain,
amount_usd,
type,
token_bought_amount,
token_bought_symbol,
token_bought_address,
token_sold_amount,
token_sold_symbol,
token_sold_address,
fee_usd,
fee_token_amount,
fee_token_symbol,
fee_token_address,
project,
version,
token_pair,
project_contract_address,
user,
botTrades.tx_id,
tx_index,
botTrades.outer_instruction_index,
COALESCE(inner_instruction_index, 0) AS inner_instruction_index,
IF(
inner_instruction_index = highestInnerInstructionIndex,
true,
false
) AS is_last_trade_in_transaction
FROM
botTrades
JOIN highestInnerInstructionIndexForEachTrade ON (
botTrades.tx_id = highestInnerInstructionIndexForEachTrade.tx_id
AND botTrades.outer_instruction_index = highestInnerInstructionIndexForEachTrade.outer_instruction_index
)
ORDER BY
block_time DESC,
tx_index DESC,
outer_instruction_index DESC,
inner_instruction_index DESC
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
block_time,block_date,block_month,bot,blockchain,amount_usd,type,token_bought_amount,token_bought_symbol,token_bought_address,token_sold_amount,token_sold_symbol,token_sold_address,fee_usd,fee_token_amount,fee_token_symbol,fee_token_address,project,version,token_pair,project_contract_address,user,tx_id,tx_index,outer_instruction_index,inner_instruction_index,is_last_trade_in_transaction
2024-06-28 10:40:46.000 UTC,2024-06-28,2024-06-01,Pinkpunk,solana,290.72,Buy,14127178.205318,MMA,CYykggFRkcWk8xLiEHvs1snGDLSATsLEsaUWdnhpump,2,SOL,So11111111111111111111111111111111111111112,2.9072000000000005,0.02,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-MMA,6Z25DRFpLy41cKU9oBVNeaVpDzqKNSWpc8DqR4scu749,713fuYcnM34x6dc3tSynyYaukXEAEvd3aHn5XK5dqYK5,LKZFgXFHf9mVipd1qsuUsqfhRJRc9iP1BFqbePK4A822t3gW7NGkzPQZaBfWnfiAobBx5FRUhnJ54RBpZTYMEsQ,298,8,1,true
2024-06-20 19:55:54.000 UTC,2024-06-20,2024-06-01,Pinkpunk,solana,4.63679638736,Sell,0.034574576,SOL,So11111111111111111111111111111111111111112,7673.041317,Genie,3Jjt8QhbqNoYfSQYHWf8ZsTJwE2CyvmUrzgzJD5Jpump,0.046251722690000004,0.000344879,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-Genie,HPFi3bRcaVLFgymbHNx6QmRStXqKbrcV3ScWM9EHXGZu,AvkWSPTcZ7TdwbEFaxiLCphRj8aFRPQTYo4uRonSHXM1,4ctsnXXCPPFbf9EnRcr2RbQ3TxzdyjvvDVLPH4efFgbP5ByR3Gpgeg3BWNvRnEHAJsC2LiEhyChFZy97z2QKBzvu,734,5,1,true
2024-06-13 18:20:57.000 UTC,2024-06-13,2024-06-01,Pinkpunk,solana,83.62445656068,Sell,0.562445901,SOL,So11111111111111111111111111111111111111112,1043421.125085,MMA,CYykggFRkcWk8xLiEHvs1snGDLSATsLEsaUWdnhpump,0.12512358684000002,0.000841563,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-MMA,6Z25DRFpLy41cKU9oBVNeaVpDzqKNSWpc8DqR4scu749,AvkWSPTcZ7TdwbEFaxiLCphRj8aFRPQTYo4uRonSHXM1,4cihZjgKeydqD8Fa9JB1nKgK8QAownvqMixJG4tMhrP9LThF57mqnXF71tx327UmgzKLN6FYs86knjm6v2Pi3Bn8,1065,5,1,true
2024-06-27 07:46:58.000 UTC,2024-06-27,2024-06-01,Pinkpunk,solana,0.28849689908,Sell,0.002120677,SOL,So11111111111111111111111111111111111111112,0.189704,RAY,4k3Dyjzvzp8eMZWUXbBCjEvwSkkk59S5iCNLY3QrkX6R,0.00289942052,0.000021313,SOL,So11111111111111111111111111111111111111112,raydium,3,SOL-RAY,Enfoa5Xdtirwa46xxa5LUVcQWe7EUb2pGzTjfvU7EBS1,58YUZtT9zbtDUw6nizFoAUii77TYiHoKNKX1PJRUJCPG,RJRU4beKEVgSmiNaC9rNQCw7CamcsW94BowVXLyjkXjETWDUTs9K1PYfeCynKWs9V3fuiAfxoHzEDVq1DdsrWpC,136,5,7,true
2024-06-13 05:14:47.000 UTC,2024-06-13,2024-06-01,Pinkpunk,solana,76.27,Buy,1043421.125085,MMA,CYykggFRkcWk8xLiEHvs1snGDLSATsLEsaUWdnhpump,0.5,SOL,So11111111111111111111111111111111111111112,0.11440499999999999,0.00075,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-MMA,6Z25DRFpLy41cKU9oBVNeaVpDzqKNSWpc8DqR4scu749,AvkWSPTcZ7TdwbEFaxiLCphRj8aFRPQTYo4uRonSHXM1,48wVKDGhxiND8d19C9DbHRZEoq4KBeUNpfbU5VtW8ezLxMGUrrYfYeebhG4DwjQr1QXGVStczpyCoABFEULJjzFP,462,8,1,true
2024-06-20 08:08:19.000 UTC,2024-06-20,2024-06-01,Pinkpunk,solana,2.7434,Buy,3795.620367,bicho,GkJxELgJXpQRm7dfc2yS18vBDRxP5SjVJgbrmTGgpump,0.02,SOL,So11111111111111111111111111111111111111112,0.0041151,0.00003,SOL,So11111111111111111111111111111111111111112,whirlpool,1,SOL-bicho,GAoBPeBRo2u6XBJja3a8coH3S6oYmf3a5Fbw9HQQuorT,AvkWSPTcZ7TdwbEFaxiLCphRj8aFRPQTYo4uRonSHXM1,PCfWMMuZGyBMaY2K281HvaMepoeYeB7TMgFbNTfXPwXeL9rGC2552xvjaHvFFjGXDQXfUMLyqaKtwQNPpiwGVqW,1804,8,1,true
2024-06-21 10:57:25.000 UTC,2024-06-21,2024-06-01,Pinkpunk,solana,421.73435647310004,Sell,3.181700162,SOL,So11111111111111111111111111111111111111112,16988240.632515,MMA,CYykggFRkcWk8xLiEHvs1snGDLSATsLEsaUWdnhpump,4.2173434825500005,0.031817001,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-MMA,6Z25DRFpLy41cKU9oBVNeaVpDzqKNSWpc8DqR4scu749,713fuYcnM34x6dc3tSynyYaukXEAEvd3aHn5XK5dqYK5,5ayJLVaG5MwETuifYJgjEU4gVSZLyyNbtP7U1xGsRpzZXg77PckGtBa9FkNspTDG5xWFkqk2p1Rz14qZt6QUKs73,2081,5,1,true
2024-06-27 16:12:26.000 UTC,2024-06-27,2024-06-01,Pinkpunk,solana,14.772,Buy,335138.666114,SAIF,7wr37DaTbLe2qxBb24gEaBL93XRrY2GQoj8GkCVdpump,0.1,SOL,So11111111111111111111111111111111111111112,0.14772,0.001,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-SAIF,acaDbR5Qw2rxYehzNvUEMQrHQwXpzCdWsmZ2daoMrVk,713fuYcnM34x6dc3tSynyYaukXEAEvd3aHn5XK5dqYK5,52DyJ178yzJdbjBy5dRXeQAcFMUkCTfVxY7ytSN7j68prgvSizTuE6RjiNDD5eU25XmKdbQ1QS5kkxsaF5wqB3Zi,69,8,1,true
2024-06-27 15:31:17.000 UTC,2024-06-27,2024-06-01,Pinkpunk,solana,73.485,Buy,1488787.001183,SAIF,7wr37DaTbLe2qxBb24gEaBL93XRrY2GQoj8GkCVdpump,0.5,SOL,So11111111111111111111111111111111111111112,0.73485,0.005,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-SAIF,acaDbR5Qw2rxYehzNvUEMQrHQwXpzCdWsmZ2daoMrVk,713fuYcnM34x6dc3tSynyYaukXEAEvd3aHn5XK5dqYK5,3SCZ6RAbwobTQiKPcmCWsTjR5N676U3x1FPyRkTG5QoWW3YWGPwEdE7Cuqnx3ZQPEzKCsBuU3fiLqHd7B6msv6dC,1202,8,1,true
2024-06-28 05:29:52.000 UTC,2024-06-28,2024-06-01,Pinkpunk,solana,14.454,Buy,55078.67015,VIVOOK,6VeSg58mGb8SGuJ8VPq8JcrD8WdfHemCvvUJrfK8pump,0.1,SOL,So11111111111111111111111111111111111111112,0.14454,0.001,SOL,So11111111111111111111111111111111111111112,raydium,4,VIVOOK-SOL,33QEPkS7i8AZqSQF8qGqDt9vQDeksn2CWaZzcQvTTy6W,7Zj1vrrXhyUNZZRGgXp71bDUdwcTUQq758ypcrDeyS4M,2TaP7V7yHvDuBkXm7xSAnRDUfCPBn54pK7rc6Rpv6cBiWCjzFHww47zENa9BQBqccedWGGioBnCum1EDRX6d9CUz,277,8,1,true
2024-06-20 07:00:13.000 UTC,2024-06-20,2024-06-01,Pinkpunk,solana,2.82931434026,Sell,0.020862073,SOL,So11111111111111111111111111111111111111112,3410.240584,Genie,3Jjt8QhbqNoYfSQYHWf8ZsTJwE2CyvmUrzgzJD5Jpump,0.004233242680000001,0.000031214,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-Genie,HPFi3bRcaVLFgymbHNx6QmRStXqKbrcV3ScWM9EHXGZu,AvkWSPTcZ7TdwbEFaxiLCphRj8aFRPQTYo4uRonSHXM1,2YxpkhShL4tfhQt5D2hvy4Q4zNkCQTiUMciv3TPZaEABTSfp6g8qciNjDmGQTcKe5hZDjUk3tYsSyp1RfsfnWTpg,2362,5,1,true
2024-06-28 17:20:00.000 UTC,2024-06-28,2024-06-01,Pinkpunk,solana,30.266632104210004,Sell,0.211906687,SOL,So11111111111111111111111111111111111111112,434067.115914,$MIYO,GoshErFq1rXBwYnUz2YsdnXhkEJgSDf11bBCT4iopump,0.19738663227000003,0.001381969,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-$MIYO,9rphvvSa2zBDhbWhhZCgC16HgXFnLC5kJaowWqqJP7oY,3gqBMsX8Qf8Gh7BBHMsuMwB7QBtTVYAGZLcFs3eTDiws,3EctRdT8ACKqEUKnmXpmB9ui9GAd4awJzdKBwLmfaJg174kybPj58vrCkHfdfU9KzwtGYayVg1jWGTrMwZ2UX5Br,1757,5,1,true
2024-06-24 05:31:05.000 UTC,2024-06-24,2024-06-01,Pinkpunk,solana,62.485,Buy,3267740.716914,MMA,CYykggFRkcWk8xLiEHvs1snGDLSATsLEsaUWdnhpump,0.5,SOL,So11111111111111111111111111111111111111112,0.62485,0.005,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-MMA,6Z25DRFpLy41cKU9oBVNeaVpDzqKNSWpc8DqR4scu749,713fuYcnM34x6dc3tSynyYaukXEAEvd3aHn5XK5dqYK5,4CqFkwmPnLTBa2qVTEoNr8qxCWr4ieq5m6ivhkL2qwrHVHxVvgz9nZaQz2epubYoJNUstqf6xFnm69HHZAsTHMW9,45,8,1,true
2024-06-25 10:06:24.000 UTC,2024-06-25,2024-06-01,Pinkpunk,solana,81.02081063824,Sell,0.591651896,SOL,So11111111111111111111111111111111111111112,777062.241721,SAIF,7wr37DaTbLe2qxBb24gEaBL93XRrY2GQoj8GkCVdpump,0.8141022746400001,0.005944956,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-SAIF,acaDbR5Qw2rxYehzNvUEMQrHQwXpzCdWsmZ2daoMrVk,AvkWSPTcZ7TdwbEFaxiLCphRj8aFRPQTYo4uRonSHXM1,2B64ZKokQS5GPL12XRqc6c58r9gXzvVtwTGYQVW1H2TXGtKtAN9dE55tzmXhVWztsqyK9fUKbFrP2FuGGaHC7eLb,259,5,1,true
2024-06-26 09:26:29.000 UTC,2024-06-26,2024-06-01,Pinkpunk,solana,2.7332,Buy,7.891392,W,85VBFQZC9TZkfaptBWjvUw7YbZjy52A6mjtPGjstQAmQ,0.02,SOL,So11111111111111111111111111111111111111112,0.027332000000000002,0.0002,SOL,So11111111111111111111111111111111111111112,raydium,3,W-SOL,E5tLAoEfH9LSYtw2x8i82JuDj5Gd2S6ZZFx4KB4xWqE,58YUZtT9zbtDUw6nizFoAUii77TYiHoKNKX1PJRUJCPG,3iPdmyoRRtc51nQYCo55BAYWZtB9a4jBMsq1NbJ58LiWGnzwW6zHgiLo3LAHBE56WHwMyrbhM2tVkbMZCAd6imuP,419,8,1,true
2024-06-24 13:10:55.000 UTC,2024-06-24,2024-06-01,Pinkpunk,solana,25.51,Buy,180043.865397,SAIF,7wr37DaTbLe2qxBb24gEaBL93XRrY2GQoj8GkCVdpump,0.2,SOL,So11111111111111111111111111111111111111112,0.2551,0.002,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-SAIF,acaDbR5Qw2rxYehzNvUEMQrHQwXpzCdWsmZ2daoMrVk,AvkWSPTcZ7TdwbEFaxiLCphRj8aFRPQTYo4uRonSHXM1,3pz6u6q1AFNvMRUp5Bbcgq73qfc3B1sVcLhAGECn9xP8TYJn7rEipuDwXrooTfPBL31XH7zMEkJ5uyHgw27fzpzw,817,8,1,true
2024-06-25 10:00:59.000 UTC,2024-06-25,2024-06-01,Pinkpunk,solana,124.24005298784,Sell,0.905275816,SOL,So11111111111111111111111111111111111111112,1029210.099465,SAIF,7wr37DaTbLe2qxBb24gEaBL93XRrY2GQoj8GkCVdpump,1.24240050792,0.009052758,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-SAIF,acaDbR5Qw2rxYehzNvUEMQrHQwXpzCdWsmZ2daoMrVk,713fuYcnM34x6dc3tSynyYaukXEAEvd3aHn5XK5dqYK5,4S1zy8pRJQax25D9oNvYWU5mEh5SFXKrc2hYDuc2bQxYVYzb6WMVqostEcyCvpkmTwRSGecRd3zGFaWrnF3eyQGQ,1845,5,1,true
2024-06-27 07:46:58.000 UTC,2024-06-27,2024-06-01,Pinkpunk,solana,0.289414719539,Sell,0.289201,USDC,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,0.889382,W,85VBFQZC9TZkfaptBWjvUw7YbZjy52A6mjtPGjstQAmQ,0.00289942052,0.000021313,SOL,So11111111111111111111111111111111111111112,raydium,4,W-USDC,FATXepBcZ6otK4BZXgWP31TsKYqA7ApkbS7BeHXn7wdP,58YUZtT9zbtDUw6nizFoAUii77TYiHoKNKX1PJRUJCPG,RJRU4beKEVgSmiNaC9rNQCw7CamcsW94BowVXLyjkXjETWDUTs9K1PYfeCynKWs9V3fuiAfxoHzEDVq1DdsrWpC,136,5,1,false
2024-06-27 13:55:28.000 UTC,2024-06-27,2024-06-01,Pinkpunk,solana,147.82,Buy,3372908.437513,SAIF,7wr37DaTbLe2qxBb24gEaBL93XRrY2GQoj8GkCVdpump,1,SOL,So11111111111111111111111111111111111111112,1.4782,0.01,SOL,So11111111111111111111111111111111111111112,raydium,4,SOL-SAIF,acaDbR5Qw2rxYehzNvUEMQrHQwXpzCdWsmZ2daoMrVk,713fuYcnM34x6dc3tSynyYaukXEAEvd3aHn5XK5dqYK5,5DFMcMrMH8FVBhVc8KmQcq663oz4dXNGi4jdmRtzzUbFSM2BUHgPgpziniCzf6TWhcS6DDezbhgGBNJPocBEBtLo,836,8,1,true
2024-06-25 11:15:09.000 UTC,2024-06-25,2024-06-01,Pinkpunk,solana,0.000138066516,Buy,0.000138,USDT,Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB,0.000001,SOL,So11111111111111111111111111111111111111112,0.0000013847,1e-8,SOL,So11111111111111111111111111111111111111112,raydium,3,USDT-SOL,3nMFwZXwY1s1M5s8vYAHqd4wGs4iSxXE4LRoUMMYqEgF,BneB4e7c7y56t6WYeGcfyk6G54xW78f7pUYYTUeJaEeg,1VpWauQq5MdfTwdTV6ecVmhakppg2vquV1YbEjcTYXyUcBmS51AK3XohzQLvKwBg5JG4JSeJt6AphktX7JEEccy,1372,8,1,false
Loading