通過sql語句分析足彩

jeanron100發表於2014-08-05

老是做工作中的資料分析,最近也在看足球彩票,競猜遊戲有輸有贏,但是裡面還是有不少的資料分析的樂趣,關於足球彩票的分析,自己寫了如下的程式,可以參考。當然了,最好能帶有主觀的分析,這樣可能準確率要高一些。
以下是僅根據賠率做的一個分析。
比如我們目前計劃投資100塊買單場競猜,勝平負的賠率就有很大的差別,可以考慮有賠率大的部分來彌補賠率小的部分,這樣能夠基本達到中和(但是話說過來,競猜公司的計算更是精準,通過自己其他的公式和計算,資料的範圍都牢牢控制在它們的制定範圍內)。
可以直接執行一下的指令碼,假設資料庫使用者是n1
win_point=$1
tie_point=$2
lose_point=$3
max_cnt=100
echo $win_point ,  $tie_point , $lose_point

sqlplus -s n1/n1 < drop table win_list;
set feedback off
set serveroutput on
declare
x number;
ceil_win_amt number;
ceil_tie_amt number;
ceil_lose_amt number;
ceil_tot_amt number;
round_win_amt number;
round_tie_amt number;
round_lose_amt number;
round_tot_amt number;
begin
for x in 2..$max_cnt loop
        if (x<=((2*$win_point*$win_point*$tie_point*$tie_point*$lose_point*$lose_point)/($win_point*$tie_point+$win_point*$lose_point +$tie_point*$lose_point-$win_point
*$tie_point*$lose_point )))
        then
          round_win_amt:=round(x/$win_point/2);
          round_tie_amt:=round(x/$tie_point/2);
          round_lose_amt:=round(x/$lose_point/2);
          round_tot_amt:=round(2*(round_win_amt+round_tie_amt+round_lose_amt)-2*(round_win_amt*$win_point+round_tie_amt*$tie_point+round_lose_amt*$lose_point)/3,2);
          ceil_win_amt:=ceil(x/$win_point/2);
          ceil_tie_amt:=ceil(x/$tie_point/2);
          ceil_lose_amt:=ceil(x/$lose_point/2);
          ceil_tot_amt:=round(2*(ceil_win_amt+ceil_tie_amt+ceil_lose_amt)-2*(ceil_win_amt*$win_point+ceil_tie_amt*$tie_point+ceil_lose_amt*$lose_point)/3,2);
          dbms_output.put_line('win:'||ceil_win_amt||' tie:'||ceil_tie_amt||' lose:'||ceil_lose_amt||'------&gtwill get:'||ceil_tot_amt||' '||2*(ceil_win_amt+ceil_tie_amt
+ceil_lose_amt)||'---- '||(ceil_win_amt*$win_point+ceil_tie_amt*$tie_point+ceil_lose_amt*$lose_point));
--          dbms_output.put_line('win:'||round_win_amt||' tie:'||round_tie_amt||' lose:'||round_lose_amt||'------&gtwill get:'||_tot_amt);
          insert into win_list values(x,ceil_win_amt,ceil_tie_amt,ceil_lose_amt,ceil_tot_amt,round_win_amt,round_tie_amt,round_lose_amt,round_tot_amt);
        end if;
end loop;
commit;

end;
/
set pages 53
set linesize 200
select * from(select * from win_list  where mod(amt,2)=0 order by ceil_bonus,round_bonus desc) where rownum<500;
prompt .
select *from win_list where  mod(amt,2)=0 and ceil_win>ceil_tie and ceil_win > ceil_lose and amt  between 2 and 20;
EOF

 

執行指令碼 假設我們制定賠率 1.22 3.22 5.12
ksh win.sh 1.22 3.22 5.12
執行指令碼後,結果如下所示,AMT代表自己的投入,不過根據賠率,有一些不太一致,可能投入的要更多一些。
       AMT   CEIL_WIN   CEIL_TIE  CEIL_LOSE CEIL_BONUS  ROUND_WIN  ROUND_TIE ROUND_LOSE ROUND_BONUS
---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- -----------
         2          1          1          1       -.37          1          0          0        1.19
         4          2          1          1        .81          2          1          0        2.23
         6          3          1          1          2          2          1          1         .81
        12          5          2          2       2.81          5          2          1        4.23
         8          4          2          1       3.04          3          1          1           2
        14          6          3          2       3.85          6          2          1        5.41
        10          5          2          1       4.23          4          2          1        3.04
        16          7          3          2       5.04          7          2          2        5.19
        18          8          3          2       6.23          7          3          2        5.04
        24         10          4          3       7.04         10          4          2        8.45
        22         10          4          3       7.04          9          3          2        7.41
        20          9          4          2       7.27          8          3          2        6.23
        26         11          5          3       8.08         11          4          3        8.23
        28         12          5          3       9.27         11          4          3        8.23

最後說明這個僅供參考。分析還有不足和錯誤的地方,諒解諒解。

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/23718752/viewspace-1246019/,如需轉載,請註明出處,否則將追究法律責任。

相關文章