ªð¦^¦Cªí ¤W¤@¥DÃD µo©«

[µo°Ý] °j°é°ÝÃD

¥»©«³Ì«á¥Ñ hugh0620 ©ó 2012-3-22 10:35 ½s¿è

¦^´_ 3# spermbank

³o¬O§A»Ý­n¥h«ä¦Ò~ ­þ¤@¨Ç¬O¹Bºâ¤¤°Ê¼Æ(x)=>ì§Q1%ªº·sªÑ»ù~ ¦b½æ¥X»ùªº®É­Ô
©Ò¥H~ ¶R»ù¬O¤@­Ó¬J©wªº¨Æ¹ê±¡ªp¤U~ ¥h±Àºâ[ì§Q1%ªº·sªÑ»ù]
¦]¦¹²Ä¤G­Ó°j°é~ §Ú¥Îªº¬O do  loop
¥ý¨D±o°ò¥»ªº°Ñ¼Æ­È
1. ¶R:ªÑ»ù/¤âÄò¶O
¦A¨Ì¶RªºªÑ»ù¨ÌªÑ»ù­ì«h¤@­Ó­È¤@®æ­Ó­È¥h±Àºâ¤p©ó©Îµ¥©ó1%Àò§QªÑ»ù
2.¥Îdo loop¥h±Àºâ½æ¥XªºªÑ»ù
  1. Sub nn()

  2. '=========================='½Õ¾ãC°ÏªÑ»ù³W«h
  3. For Each A In Range("A:A").SpecialCells(xlCellTypeConstants, xlNumbers)
  4. B = Application.Lookup(A, Array(0, 11, 51, 101, 501, 1001), Array(0.01, 0.05, 0.1, 0.5, 1, 5))
  5. A.Offset(, 2) = Application.Ceiling(A, B)
  6. Next
  7. '=========================='Àò§Q1%ªÑ§Q­pºâ¡A¤£¥]§t¤âÄò¶O¡BÃÒ¥æµ|
  8. Sheets("Sheet1").Select
  9. x = Application.WorksheetFunction.CountA(Range("A:A")) 'Äæ¦ì¦³­È½d³ò­pºâ
  10. For i = 2 To x
  11.     Cells(i, "G") = Cells(i, "C") * Cells(9, "O") + Cells(i, "C")
  12. Next
  13. '=========================='½Õ¾ãÀò§QªÑ»ù³W«h
  14. For Each A In Range("G:G").SpecialCells(xlCellTypeConstants, xlNumbers)
  15. B = Application.Lookup(A, Array(0, 11, 51, 101, 501, 1001), Array(0.01, 0.05, 0.1, 0.5, 1, 5))
  16. A.Offset(, 0) = Application.Ceiling(A, B)
  17. Next
  18. '=========================='­pºâÀò§Q1%¦©°£¤âÄò¶O»PÃÒ¥æµ|ª÷ÃB
  19. Sheets("Sheet1").Select
  20. x = Application.WorksheetFunction.CountA(Range("A:A")) 'Äæ¦ì¦³­È½d³ò­pºâ

  21. For i = 2 To x
  22.         K = Cells(i, "C")    '¶R¶iªÑ»ù¡A¬O¤@­Ó©T©w­Èªº±ø¥ó¤U¡A±Àºâì§Q±µ±µªñ1%®ÉªºªÑ»ù¤ÎÀò§Q
  23.         If K * 1000 * 0.001425 * 0.28 <= 20 Then '¶R¶i¤âÄò¶O¬O¤@­Ó¤wµo¥Íªº±ø¥ó¡A­Y§C©ó20¶ê¡A«h¬°20¶ê¡A
  24.             ABuyP = 20
  25.         Else
  26.             ABuyP = B * 1000 * 0.001425 * 0.28
  27.         End If
  28.         ABuy = K * 1000 + ABuyP
  29.         B1 = Application.Lookup(K, Array(0, 11, 51, 101, 501, 1001), Array(0.01, 0.05, 0.1, 0.5, 1, 5)) 'ªÑ»ù¼W¥[¤ñ²v
  30.         J = 0
  31.         Do
  32.         B2 = B1 * J
  33.         If (K + B2) * 1000 * 0.001425 * 0.28 <= 20 Then '½æ¥X¤âÄò¶O­Y§C©ó20¶ê¡A«h¬°20¶ê
  34.             ABuyP1 = 20
  35.         Else
  36.             ABuyP1 = (K + B2) * 1000 * 0.001425 * 0.28
  37.         End If
  38.         ASell = (K + B2) * 1000 - (K + B2) * 1000 * 0.003 - ABuyP1
  39.         A = (ASell - ABuy) / ABuy
  40.         J = J + 1
  41.         Loop While A <= 0.01     '³f§Q¦b>=0.01®É¡A°±¤î¹Bºâ
  42.         Cells(i, "K") = K + B2 - B1 '­pºâÀò§Q¦©°£¤âÄò¶O»PÃÒ¥æµ|ªºÀò§Q%¼Æ
  43.         Cells(i, "L") = (((K + B2 - B1) * 1000 - (K + B2 - B1) * 1000 * 0.003 - ABuyP1) - ABuy) / ABuy
  44.         Cells(i, "M") = (((K + B2 - B1) * 1000 - (K + B2 - B1) * 1000 * 0.003 - ABuyP1) - ABuy) '­pºâÀò§Q¦©°£¤âÄò¶O»PÃÒ¥æµ|ªºÀò§Qª÷ÃB
  45. Next


  46. End Sub
½Æ»s¥N½X
¾Ç²ß¤~¯à´£¤É¦Û¤v

TOP

¦^´_ 3# spermbank


     ³o­Ó¤£¬Oµ{¦¡¹B¥Îªº°ÝÃD~
     ³o¬O¤@­Ó¹Bºâªº°ÝÃD~
¾Ç²ß¤~¯à´£¤É¦Û¤v

TOP

¦^´_ 2# hugh0620


    Àò§QªÑ»ù = C°ÏªÑ»ù*1%  
    Buy = C°ÏªÑ»ù*1000 + C°ÏªÑ»ù*¤âÄò¶O²v*¥´§é
    Sell = Àò§QªÑ»ù*1000 - Àò§QªÑ»ù*¤âÄò¶O²v*¥´§é-Àò§QªÑ»ù*ÃÒ¥æµ|
    Àò§Q%¼Æ = (Sell - Buy)/Buy
    Àò§Qª÷ÃB = Sell-Buy
    ¥t¥~:¤âÄò¶O¡A­Y¤p©ó20¤¸¥H20¤¸­pºâ¡C

    §Q¥Î³]­p°j°é©Î¬O¤°»ò¤è¦¡
    ¥i¥HÅýÀò§QªÑ»ù(·s)¦©°£¤âÄò¶O»PÃÒ¥æµ|¡A¯àÅýÀò§Q%¼ÆÁͪñ1%¤ÎÀò§Qª÷ÃB
    ·Q¤£¤Ó¥X¨Ó«ç»ò¨Ó¼g¡A½Ð¦U¦ì¤j¤j«ü±Ð¡C

TOP

¦^´_ 1# spermbank


    °ò¥»ªº¹BºâÁ`¸Ó­n´£¨Ñ¤@¤U§a~
    ­þ¨ÇÄæ¦ìªº­pºâ¬O­þ¨Ç­È¶i¦æ¹Bºâ~
    ¨Ã¤£¬O©Ò¦³¤H³£À´~ ³o¨Ç¬O«ç»ò¹Bºâºw­ò~
¾Ç²ß¤~¯à´£¤É¦Û¤v

TOP

        ÀR«ä¦Û¦b : ¤Hªº¤ß¦a¬O¤@²¥¥Ð¡A¤g¦a¨S¦³¼½¤U¦nºØ¤l¡A¤]ªø¤£¥X¦nªºªG¹ê¡C -
ªð¦^¦Cªí ¤W¤@¥DÃD