通過shell指令碼分析足彩
對於足球比賽的賠率還是很有計算方法的。我收集了一些比賽的資料,進行了簡單的分析。建立了一個表為data.
然後對於即將開始的比賽,進行勝負平的賠率計算,
簡單的shell指令碼實現如下:
sqlplus -s n1/n1 <
set linesize 200
set pages 50
set feedback on
col w format a10
col t format a10
col l format a10
col rw format a10
col rt format a10
col rl format a10
col diff_sum format 9.99
prompt --- win
prompt -- big win
select zu,ke,r,w||'('||(w-$1)||')' w,t||'('||(t-$2)||')' t,l||'('||(l-$3)||')' l,rw||'('||(rw-$4)||')' rw,rt||'('||(rt-$5)||')' rt,rl||'('||(rl-$6)||')' rl,abs(w-$1)+abs(t-$2)+abs(l-$3)+abs(rw-$4)+abs(rt-$5)+abs(rl-$6) diff_sum from data where w<=$1+0.2 and w>=$1-0.2 and l<=$3+1 and l>=$3-0.2 and rw<=$4+0.2 and rw>=$4-0.2 and rl<=$6+1 and rl>=$6-0.2 and r<=-1 and zu>ke+1 ;
prompt -- little win
select zu,ke,r,w||'('||(w-$1)||')' w,t||'('||(t-$2)||')' t,l||'('||(l-$3)||')' l,rw||'('||(rw-$4)||')' rw,rt||'('||(rt-$5)||')' rt,rl||'('||(rl-$6)||')' rl,
abs(w-$1)+abs(t-$2)+abs(l-$3)+abs(rw-$4)+abs(rt-$5)+abs(rl-$6) diff_sum from data where w<=$1+0.2 and w>=$1-0.2 and l<=$3+1 and l>=$3-0.2 and rw<=$4+0.2 and rw>=$4-0.2 and rl<=$6+1 and rl>=$6-0.2 and r<=-1 and zu=ke+1;
prompt .
prompt ---tie
select zu,ke,r,w||'('||(w-$1)||')' w,t||'('||(t-$2)||')' t,l||'('||(l-$3)||')' l,rw||'('||(rw-$4)||')' rw,rt||'('||(rt-$5)||')' rt,rl||'('||(rl-$6)||')' rl ,abs(w-$1)+abs(t-$2)+abs(l-$3)+abs(rw-$4)+abs(rt-$5)+abs(rl-$6) diff_sum from data where w<=$1+0.2 and w>=$1-0.2 and l<=$3+1 and l>=$3-0.2 and rw<=$4+0.2 and rw>=$4-0.2 and rl<=$6+1 and rl>=$6-0.2 and r<=-1 and zu=ke;
prompt .
prompt --- big lose
select zu,ke,r,w||'('||(w-$1)||')' w,t||'('||(t-$2)||')' t,l||'('||(l-$3)||')' l,rw||'('||(rw-$4)||')' rw,rt||'('||(rt-$5)||')' rt,rl||'('||(rl-$6)||')' rl ,abs(w-$1)+abs(t-$2)+abs(l-$3)+abs(rw-$4)+abs(rt-$5)+abs(rl-$6) diff_sum from data where w<=$1+0.2 and w>=$1-0.2 and l<=$3+1 and l>=$3-0.2 and rw<=$4+0.2 and rw>=$4-0.2 and rl<=$6+1 and rl>=$6-0.2 and r<=-1 and ke>zu+1;
prompt --- little lose
select zu,ke,r,w||'('||(w-$1)||')' w,t||'('||(t-$2)||')' t,l||'('||(l-$3)||')' l,rw||'('||(rw-$4)||')' rw,rt||'('||(rt-$5)||')' rt,rl||'('||(rl-$6)||')' rl ,abs(w-$1)+abs(t-$2)+abs(l-$3)+abs(rw-$4)+abs(rt-$5)+abs(rl-$6) diff_sum from data where w<=$1+0.2 and w>=$1-0.2 and l<=$3+1 and l>=$3-0.2 and rw<=$4+0.2 and rw>=$4-0.2 and rl<=$6+1 and rl>=$6-0.2 and r<=-1 and ke=zu+1;
set feedback off
declare
big_win number;
little_win number;
tie number;
big_lose number;
little_lose number;
total_cnt number;
begin
select count(*) cnt into big_win from data where w<=$1+0.2 and w>=$1-0.2 and l<=$3+1 and l>=$3-0.2 and rw<=$4+0.2 and rw>=$4-0.2 and rl<=$6+1 and rl>=$6-0.2 and r<=-1 and zu>ke+1 and (abs(w-$1)+abs(t-$2)+abs(l-$3)+abs(rw-$4)+abs(rt-$5)+abs(rl-$6))<=1;
select count(*) cnt into little_win from data where w<=$1+0.2 and w>=$1-0.2 and l<=$3+1 and l>=$3-0.2 and rw<=$4+0.2 and rw>=$4-0.2 and
rl<=$6+1 and rl>=$6-0.2 and r<=-1 and zu=ke+1 and (abs(w-$1)+abs(t-$2)+abs(l-$3)+abs(rw-$4)+abs(rt-$5)+abs(rl-$6))<=1;
select count(*) cnt into tie from data where w<=$1+0.2 and w>=$1-0.2 and l<=$3+1 and l>=$3-0.2 and rw<=$4+0.2 and rw>=$4-0.2 and
rl<=$6+1 and rl>=$6-0.2 and r<=-1 and zu=ke and (abs(w-$1)+abs(t-$2)+abs(l-$3)+abs(rw-$4)+abs(rt-$5)+abs(rl-$6))<=1;
select count(*) cnt into big_lose from data where w<=$1+0.2 and w>=$1-0.2 and l<=$3+1 and l>=$3-0.2 and rw<=$4+0.2 and rw>=$4-0.2 and
rl<=$6+1 and rl>=$6-0.2 and r<=-1 and ke>zu+1 and (abs(w-$1)+abs(t-$2)+abs(l-$3)+abs(rw-$4)+abs(rt-$5)+abs(rl-$6))<=1;
select count(*) cnt into little_lose from data where w<=$1+0.2 and w>=$1-0.2 and l<=$3+1 and l>=$3-0.2 and rw<=$4+0.2 and rw>=$4-0.2 and
rl<=$6+1 and rl>=$6-0.2 and r<=-1 and ke=zu+1 and (abs(w-$1)+abs(t-$2)+abs(l-$3)+abs(rw-$4)+abs(rt-$5)+abs(rl-$6))<=1;
select count(*) cnt into total_cnt from data where w<=$1+0.2 and w>=$1-0.2 and l<=$3+1 and l>=$3-0.2 and rw<=$4+0.2 and rw>=$4-0.2 and rl<=$6+1 and rl>=$6-0.2 and r<=-1 and (abs(w-$1)+abs(t-$2)+abs(l-$3)+abs(rw-$4)+abs(rt-$5)+abs(rl-$6))<=1;
dbms_output.put_line('big win :'||big_win||' of total:'||total_cnt||' percentage:'||round(big_win/total_cnt,2)*100||'%'||' ratio:'||to_number($1+$4));
dbms_output.put_line('little win :'||little_win||' of total:'||total_cnt||' percentage:'||round(little_win/total_cnt,2)*100||'%'||' ratio:'||to_number($1+$5));
dbms_output.put_line('tie :'||tie||' of total:'||total_cnt||' percentage:'||round(tie/total_cnt,2)*100||'%'||' ratio:'||to_number($2+$6));
dbms_output.put_line('big lose win:'||big_lose||' of total:'||total_cnt||' percentage:'||round(big_lose/total_cnt,2)*100||'%'||' ratio:'||to_number($3+$6));
dbms_output.put_line('little lose :'||little_lose||' of total:'||total_cnt||' percentage:'||round(little_lose/total_cnt,2)*100||'%'||' ratio:'||to_number($3+$6));
end;
/
EOF
來簡單的做兩個測試。如果一場比賽賠率如下,那麼有50%的可能性為勝,17%的概率為平,33%的概率為負。:)
1.91 3.5 3.2 3.85 3.65 1.68
.
big win :8 of total:30 percentage:27% ratio:5.76
little win :7 of total:30 percentage:23% ratio:5.56
tie :5 of total:30 percentage:17% ratio:5.18
big lose win:3 of total:30 percentage:10% ratio:4.88
little lose :7 of total:30 percentage:23% ratio:4.88
--END
再來一場比賽
2.35 3.45 2.45 5.1 4.1 1.45
.
big win :3 of total:19 percentage:16% ratio:7.45
little win :3 of total:19 percentage:16% ratio:6.45
tie :5 of total:19 percentage:26% ratio:4.9
big lose win:2 of total:19 percentage:11% ratio:3.9
little lose :6 of total:19 percentage:32% ratio:3.9
--END
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23718752/viewspace-1256600/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 透過shell指令碼分析足彩指令碼
- 通過sql語句分析足彩SQL
- 通過shell定製ash指令碼指令碼
- [ Shell ] 通過 Shell 指令碼匯出 CDL 網表指令碼
- 通過shell指令碼防止埠掃描指令碼
- 通過shell指令碼檢視鎖資訊指令碼
- 通過shell指令碼監控oracle session指令碼OracleSession
- [ Shell ] 通過 Shell 指令碼匯出 GDSII/OASIS 檔案指令碼
- 通過sql語句分析足彩(第三篇)SQL
- 通過shell指令碼 批量新增使用者指令碼
- 通過shell指令碼新增備庫日誌指令碼
- 通過shell指令碼來統計段大小指令碼
- 通過shell指令碼檢視procedure的資訊指令碼
- 通過shell指令碼檢視package的資訊指令碼Package
- 通過shell指令碼批量操作mysql資料庫指令碼MySql資料庫
- 通過shell指令碼檢測MySQL服務資訊指令碼MySql
- 如何通過簡單的shell指令碼操作MongoDB指令碼MongoDB
- 通過shell指令碼快速定位active session問題指令碼Session
- 通過shell指令碼得到資料字典的資訊指令碼
- 通過shell指令碼監控sql執行頻率指令碼SQL
- 通過shell指令碼定位效能sql和生成報告指令碼SQL
- 透過sql語句分析足彩SQL
- 通過shell指令碼得到資料庫的基本資訊(一)指令碼資料庫
- 通過shell指令碼監控日誌切換頻率指令碼
- 通過shell指令碼批量驗證dataguard的有效性指令碼
- 通過shell指令碼生成查詢表資料的sql指令碼SQL
- 《通過指令碼檢視哪些ip被佔用》shell筆記指令碼筆記
- 通過shell指令碼生成資料統計資訊的報表指令碼
- 通過shell指令碼抓取awr報告中的問題sql指令碼SQL
- 通過shell得到資料庫中許可權的指令碼資料庫指令碼
- Linux通過Shell指令碼命令修改密碼不需要互動Linux指令碼密碼
- 透過shell定製ash指令碼指令碼
- 案例:通過shell指令碼實現mysql資料備份與清理指令碼MySql
- 通過shell指令碼來得到不穩定的執行計劃指令碼
- 通過shell指令碼來檢視Undo中資源消耗高的sql指令碼SQL
- Oracle通過Sqlplus結合Shell指令碼方式生成Excel檔案OracleSQL指令碼Excel
- 《怎樣實現通過shell指令碼將使用者踢出系統》指令碼
- 通過shell指令碼同時監控多個資料庫負載指令碼資料庫負載