-- Illustrative changes and charts for existing sample projects only; never real market performance.
begin;
with samples(slug,symbol,ratios) as (values
('solar-power-revenue','eSOL',array[0.972,0.973739,0.974048,0.974434,0.978304,0.977506,0.972485,0.975883,0.980864,0.97656,0.977939,0.989056,0.988729,0.981214,0.986305,0.990003,0.980138,0.979087,0.990144,0.990325,0.986231,0.99448,0.999481,0.99246,0.991203,0.996318,0.994607,0.992512,0.996807,0.999323,0.999003,1]::numeric[]),
('izadshahr-cultural-complex','IZAD',array[1.013,1.013029,1.011737,1.013064,1.014362,1.009109,1.006535,1.010851,1.008402,1.003168,1.0103,1.016128,1.008495,1.006868,1.013585,1.007057,0.996997,1.003008,1.00782,1.000856,1.002655,1.011733,1.008027,1.000999,1.00406,1.004428,0.998471,0.998697,1.002162,1.001087,1.000058,1]::numeric[]),
('digital-oil','OIL',array[0.981,0.981486,0.982239,0.985565,0.984792,0.980943,0.983899,0.986216,0.980567,0.982319,0.992508,0.991503,0.986478,0.993706,0.996057,0.98494,0.984038,0.992964,0.989993,0.986228,0.996363,1.001264,0.994339,0.994698,0.999658,0.995567,0.992236,0.996805,0.998955,0.997914,0.999316,1]::numeric[]),
('decentralized-app-store','DAPP',array[0.956,0.95706,0.959991,0.962905,0.960835,0.961324,0.966179,0.963785,0.960477,0.969075,0.975184,0.970453,0.97392,0.983199,0.977573,0.970093,0.977648,0.981031,0.974263,0.979469,0.991088,0.989013,0.985686,0.992402,0.993464,0.987672,0.989793,0.995103,0.99503,0.995984,0.99909,1]::numeric[]),
('nft-marketplace','PNFT',array[1.024,1.023189,1.024397,1.022834,1.0194,1.021142,1.020485,1.012967,1.013355,1.020334,1.016943,1.012986,1.02099,1.021596,1.009684,1.00869,1.014194,1.006639,1.001518,1.011187,1.014039,1.006572,1.008319,1.012484,1.005403,1.000197,1.003551,1.003286,1.000094,1.001136,1.001622,1]::numeric[])
)
update public.projects p set symbol=s.symbol,
 price_24h_ago_rial=round(p.unit_price_rial*s.ratios[1]),
 price_history_24h=(select jsonb_agg(round(p.unit_price_rial*r) order by ord) from unnest(s.ratios) with ordinality as points(r,ord)),
 market_updated_at=now()
from samples s where p.slug=s.slug and p.is_demo=true and p.price_24h_ago_rial is null;
commit;
